From 3659ead7cce8b73d486bcdb18c507151d0ea8a57 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 24 Jun 2022 10:02:50 +0000 Subject: [PATCH 1/2] feat: support regapic LRO Use gapic-generator-typescript v2.15.1. PiperOrigin-RevId: 456946341 Source-Link: https://github.com/googleapis/googleapis/commit/88fd18d9d3b872b3d06a3d9392879f50b5bf3ce5 Source-Link: https://github.com/googleapis/googleapis-gen/commit/accfa371f667439313335c64042b063c1c53102e Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYWNjZmEzNzFmNjY3NDM5MzEzMzM1YzY0MDQyYjA2M2MxYzUzMTAyZSJ9 --- owl-bot-staging/v1/.eslintignore | 7 + owl-bot-staging/v1/.eslintrc.json | 3 + owl-bot-staging/v1/.gitignore | 14 + owl-bot-staging/v1/.jsdoc.js | 55 + owl-bot-staging/v1/.mocharc.js | 33 + owl-bot-staging/v1/.prettierrc.js | 22 + owl-bot-staging/v1/README.md | 1 + owl-bot-staging/v1/linkinator.config.json | 16 + owl-bot-staging/v1/package.json | 64 + .../security/privateca/v1/resources.proto | 1123 ++++ .../cloud/security/privateca/v1/service.proto | 1277 +++++ ..._service.activate_certificate_authority.js | 86 + ...ficate_authority_service.create_ca_pool.js | 85 + ...te_authority_service.create_certificate.js | 105 + ...ty_service.create_certificate_authority.js | 86 + ...ity_service.create_certificate_template.js | 86 + ...ficate_authority_service.delete_ca_pool.js | 74 + ...ty_service.delete_certificate_authority.js | 85 + ...ity_service.delete_certificate_template.js | 74 + ...y_service.disable_certificate_authority.js | 74 + ...ty_service.enable_certificate_authority.js | 74 + ...ficate_authority_service.fetch_ca_certs.js | 73 + ...service.fetch_certificate_authority_csr.js | 59 + ...rtificate_authority_service.get_ca_pool.js | 58 + ...icate_authority_service.get_certificate.js | 58 + ...ority_service.get_certificate_authority.js | 59 + ...service.get_certificate_revocation_list.js | 59 + ...hority_service.get_certificate_template.js | 59 + ...ificate_authority_service.list_ca_pools.js | 84 + ...ty_service.list_certificate_authorities.js | 84 + ...rvice.list_certificate_revocation_lists.js | 84 + ...rity_service.list_certificate_templates.js | 84 + ...ate_authority_service.list_certificates.js | 88 + ...te_authority_service.revoke_certificate.js | 79 + ..._service.undelete_certificate_authority.js | 74 + ...ficate_authority_service.update_ca_pool.js | 78 + ...te_authority_service.update_certificate.js | 77 + ...ty_service.update_certificate_authority.js | 78 + ...vice.update_certificate_revocation_list.js | 78 + ...ity_service.update_certificate_template.js | 78 + ...ta.google.cloud.security.privateca.v1.json | 1407 +++++ owl-bot-staging/v1/src/index.ts | 25 + .../certificate_authority_service_client.ts | 4427 ++++++++++++++ ...icate_authority_service_client_config.json | 176 + ...tificate_authority_service_proto_list.json | 4 + owl-bot-staging/v1/src/v1/gapic_metadata.json | 333 ++ owl-bot-staging/v1/src/v1/index.ts | 19 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + owl-bot-staging/v1/system-test/install.ts | 49 + .../gapic_certificate_authority_service_v1.ts | 5062 +++++++++++++++++ owl-bot-staging/v1/tsconfig.json | 19 + owl-bot-staging/v1/webpack.config.js | 64 + owl-bot-staging/v1beta1/.eslintignore | 7 + owl-bot-staging/v1beta1/.eslintrc.json | 3 + owl-bot-staging/v1beta1/.gitignore | 14 + owl-bot-staging/v1beta1/.jsdoc.js | 55 + owl-bot-staging/v1beta1/.mocharc.js | 33 + owl-bot-staging/v1beta1/.prettierrc.js | 22 + owl-bot-staging/v1beta1/README.md | 1 + .../v1beta1/linkinator.config.json | 16 + owl-bot-staging/v1beta1/package.json | 64 + .../privateca/v1beta1/resources.proto | 903 +++ .../security/privateca/v1beta1/service.proto | 871 +++ ..._service.activate_certificate_authority.js | 86 + ...te_authority_service.create_certificate.js | 86 + ...ty_service.create_certificate_authority.js | 86 + ...y_service.disable_certificate_authority.js | 74 + ...ty_service.enable_certificate_authority.js | 74 + ...service.fetch_certificate_authority_csr.js | 59 + ...icate_authority_service.get_certificate.js | 58 + ...ority_service.get_certificate_authority.js | 59 + ...service.get_certificate_revocation_list.js | 59 + ...e_authority_service.get_reusable_config.js | 58 + ...ty_service.list_certificate_authorities.js | 84 + ...rvice.list_certificate_revocation_lists.js | 84 + ...ate_authority_service.list_certificates.js | 88 + ...authority_service.list_reusable_configs.js | 84 + ...y_service.restore_certificate_authority.js | 74 + ...te_authority_service.revoke_certificate.js | 78 + ...e.schedule_delete_certificate_authority.js | 74 + ...te_authority_service.update_certificate.js | 77 + ...ty_service.update_certificate_authority.js | 78 + ...vice.update_certificate_revocation_list.js | 78 + ...ogle.cloud.security.privateca.v1beta1.json | 963 ++++ owl-bot-staging/v1beta1/src/index.ts | 25 + .../certificate_authority_service_client.ts | 3027 ++++++++++ ...icate_authority_service_client_config.json | 131 + ...tificate_authority_service_proto_list.json | 4 + .../v1beta1/src/v1beta1/gapic_metadata.json | 239 + owl-bot-staging/v1beta1/src/v1beta1/index.ts | 19 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v1beta1/system-test/install.ts | 49 + ...c_certificate_authority_service_v1beta1.ts | 3271 +++++++++++ owl-bot-staging/v1beta1/tsconfig.json | 19 + owl-bot-staging/v1beta1/webpack.config.js | 64 + 97 files changed, 27836 insertions(+) create mode 100644 owl-bot-staging/v1/.eslintignore create mode 100644 owl-bot-staging/v1/.eslintrc.json create mode 100644 owl-bot-staging/v1/.gitignore create mode 100644 owl-bot-staging/v1/.jsdoc.js create mode 100644 owl-bot-staging/v1/.mocharc.js create mode 100644 owl-bot-staging/v1/.prettierrc.js create mode 100644 owl-bot-staging/v1/README.md create mode 100644 owl-bot-staging/v1/linkinator.config.json create mode 100644 owl-bot-staging/v1/package.json create mode 100644 owl-bot-staging/v1/protos/google/cloud/security/privateca/v1/resources.proto create mode 100644 owl-bot-staging/v1/protos/google/cloud/security/privateca/v1/service.proto create mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.activate_certificate_authority.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.create_ca_pool.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.create_certificate.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.create_certificate_authority.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.create_certificate_template.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.delete_ca_pool.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.delete_certificate_authority.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.delete_certificate_template.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.disable_certificate_authority.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.enable_certificate_authority.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.fetch_ca_certs.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.fetch_certificate_authority_csr.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.get_ca_pool.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.get_certificate.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.get_certificate_authority.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.get_certificate_revocation_list.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.get_certificate_template.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.list_ca_pools.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.list_certificate_authorities.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.list_certificate_revocation_lists.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.list_certificate_templates.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.list_certificates.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.revoke_certificate.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.undelete_certificate_authority.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.update_ca_pool.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.update_certificate.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.update_certificate_authority.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.update_certificate_revocation_list.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.update_certificate_template.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.security.privateca.v1.json create mode 100644 owl-bot-staging/v1/src/index.ts create mode 100644 owl-bot-staging/v1/src/v1/certificate_authority_service_client.ts create mode 100644 owl-bot-staging/v1/src/v1/certificate_authority_service_client_config.json create mode 100644 owl-bot-staging/v1/src/v1/certificate_authority_service_proto_list.json create mode 100644 owl-bot-staging/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/v1/src/v1/index.ts create mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/v1/system-test/install.ts create mode 100644 owl-bot-staging/v1/test/gapic_certificate_authority_service_v1.ts create mode 100644 owl-bot-staging/v1/tsconfig.json create mode 100644 owl-bot-staging/v1/webpack.config.js create mode 100644 owl-bot-staging/v1beta1/.eslintignore create mode 100644 owl-bot-staging/v1beta1/.eslintrc.json create mode 100644 owl-bot-staging/v1beta1/.gitignore create mode 100644 owl-bot-staging/v1beta1/.jsdoc.js create mode 100644 owl-bot-staging/v1beta1/.mocharc.js create mode 100644 owl-bot-staging/v1beta1/.prettierrc.js create mode 100644 owl-bot-staging/v1beta1/README.md create mode 100644 owl-bot-staging/v1beta1/linkinator.config.json create mode 100644 owl-bot-staging/v1beta1/package.json create mode 100644 owl-bot-staging/v1beta1/protos/google/cloud/security/privateca/v1beta1/resources.proto create mode 100644 owl-bot-staging/v1beta1/protos/google/cloud/security/privateca/v1beta1/service.proto create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.activate_certificate_authority.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.create_certificate.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.create_certificate_authority.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.disable_certificate_authority.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.enable_certificate_authority.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.fetch_certificate_authority_csr.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.get_certificate.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.get_certificate_authority.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.get_certificate_revocation_list.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.get_reusable_config.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.list_certificate_authorities.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.list_certificate_revocation_lists.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.list_certificates.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.list_reusable_configs.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.restore_certificate_authority.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.revoke_certificate.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.schedule_delete_certificate_authority.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.update_certificate.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.update_certificate_authority.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.update_certificate_revocation_list.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.security.privateca.v1beta1.json create mode 100644 owl-bot-staging/v1beta1/src/index.ts create mode 100644 owl-bot-staging/v1beta1/src/v1beta1/certificate_authority_service_client.ts create mode 100644 owl-bot-staging/v1beta1/src/v1beta1/certificate_authority_service_client_config.json create mode 100644 owl-bot-staging/v1beta1/src/v1beta1/certificate_authority_service_proto_list.json create mode 100644 owl-bot-staging/v1beta1/src/v1beta1/gapic_metadata.json create mode 100644 owl-bot-staging/v1beta1/src/v1beta1/index.ts create mode 100644 owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/v1beta1/system-test/install.ts create mode 100644 owl-bot-staging/v1beta1/test/gapic_certificate_authority_service_v1beta1.ts create mode 100644 owl-bot-staging/v1beta1/tsconfig.json create mode 100644 owl-bot-staging/v1beta1/webpack.config.js diff --git a/owl-bot-staging/v1/.eslintignore b/owl-bot-staging/v1/.eslintignore new file mode 100644 index 0000000..cfc348e --- /dev/null +++ b/owl-bot-staging/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/v1/.eslintrc.json b/owl-bot-staging/v1/.eslintrc.json new file mode 100644 index 0000000..7821534 --- /dev/null +++ b/owl-bot-staging/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/v1/.gitignore b/owl-bot-staging/v1/.gitignore new file mode 100644 index 0000000..5d32b23 --- /dev/null +++ b/owl-bot-staging/v1/.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/owl-bot-staging/v1/.jsdoc.js b/owl-bot-staging/v1/.jsdoc.js new file mode 100644 index 0000000..8ee4107 --- /dev/null +++ b/owl-bot-staging/v1/.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/security-private-ca', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/v1/.mocharc.js b/owl-bot-staging/v1/.mocharc.js new file mode 100644 index 0000000..481c522 --- /dev/null +++ b/owl-bot-staging/v1/.mocharc.js @@ -0,0 +1,33 @@ +// 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. ** + +const config = { + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000 +} +if (process.env.MOCHA_THROW_DEPRECATION === 'false') { + delete config['throw-deprecation']; +} +if (process.env.MOCHA_REPORTER) { + config.reporter = process.env.MOCHA_REPORTER; +} +if (process.env.MOCHA_REPORTER_OUTPUT) { + config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; +} +module.exports = config diff --git a/owl-bot-staging/v1/.prettierrc.js b/owl-bot-staging/v1/.prettierrc.js new file mode 100644 index 0000000..494e147 --- /dev/null +++ b/owl-bot-staging/v1/.prettierrc.js @@ -0,0 +1,22 @@ +// 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. ** + + +module.exports = { + ...require('gts/.prettierrc.json') +} diff --git a/owl-bot-staging/v1/README.md b/owl-bot-staging/v1/README.md new file mode 100644 index 0000000..c74f8ea --- /dev/null +++ b/owl-bot-staging/v1/README.md @@ -0,0 +1 @@ +Privateca: Nodejs Client diff --git a/owl-bot-staging/v1/linkinator.config.json b/owl-bot-staging/v1/linkinator.config.json new file mode 100644 index 0000000..befd23c --- /dev/null +++ b/owl-bot-staging/v1/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/owl-bot-staging/v1/package.json b/owl-bot-staging/v1/package.json new file mode 100644 index 0000000..541fa74 --- /dev/null +++ b/owl-bot-staging/v1/package.json @@ -0,0 +1,64 @@ +{ + "name": "@google-cloud/security-private-ca", + "version": "0.1.0", + "description": "Privateca client for Node.js", + "repository": "googleapis/nodejs-privateca", + "license": "Apache-2.0", + "author": "Google LLC", + "main": "build/src/index.js", + "files": [ + "build/src", + "build/protos" + ], + "keywords": [ + "google apis client", + "google api client", + "google apis", + "google api", + "google", + "google cloud platform", + "google cloud", + "cloud", + "google privateca", + "privateca", + "certificate authority service" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "predocs-test": "npm run docs", + "docs-test": "linkinator docs", + "fix": "gts fix", + "lint": "gts check", + "prepare": "npm run compile-protos && npm run compile", + "system-test": "c8 mocha build/system-test", + "test": "c8 mocha build/test" + }, + "dependencies": { + "google-gax": "^3.1.1" + }, + "devDependencies": { + "@types/mocha": "^9.1.0", + "@types/node": "^16.0.0", + "@types/sinon": "^10.0.8", + "c8": "^7.11.0", + "gts": "^3.1.0", + "jsdoc": "^3.6.7", + "jsdoc-fresh": "^1.1.1", + "jsdoc-region-tag": "^1.3.1", + "linkinator": "^3.0.0", + "mocha": "^9.1.4", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^13.0.0", + "ts-loader": "^9.2.6", + "typescript": "^4.5.5", + "webpack": "^5.67.0", + "webpack-cli": "^4.9.1" + }, + "engines": { + "node": ">=v12" + } +} diff --git a/owl-bot-staging/v1/protos/google/cloud/security/privateca/v1/resources.proto b/owl-bot-staging/v1/protos/google/cloud/security/privateca/v1/resources.proto new file mode 100644 index 0000000..3f6dfb1 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/security/privateca/v1/resources.proto @@ -0,0 +1,1123 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.security.privateca.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; +import "google/type/expr.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Security.PrivateCA.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/security/privateca/v1;privateca"; +option java_multiple_files = true; +option java_outer_classname = "PrivateCaResourcesProto"; +option java_package = "com.google.cloud.security.privateca.v1"; +option php_namespace = "Google\\Cloud\\Security\\PrivateCA\\V1"; +option ruby_package = "Google::Cloud::Security::PrivateCA::V1"; + +// A [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] represents an individual Certificate Authority. +// A [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] can be used to create [Certificates][google.cloud.security.privateca.v1.Certificate]. +message CertificateAuthority { + option (google.api.resource) = { + type: "privateca.googleapis.com/CertificateAuthority" + pattern: "projects/{project}/locations/{location}/caPools/{ca_pool}/certificateAuthorities/{certificate_authority}" + }; + + // The type of a [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority], indicating its issuing chain. + enum Type { + // Not specified. + TYPE_UNSPECIFIED = 0; + + // Self-signed CA. + SELF_SIGNED = 1; + + // Subordinate CA. Could be issued by a Private CA [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + // or an unmanaged CA. + SUBORDINATE = 2; + } + + // The state of a [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority], indicating if it can be used. + enum State { + // Not specified. + STATE_UNSPECIFIED = 0; + + // Certificates can be issued from this CA. CRLs will be generated for this + // CA. The CA will be part of the [CaPool][google.cloud.security.privateca.v1.CaPool]'s trust anchor, and will be + // used to issue certificates from the [CaPool][google.cloud.security.privateca.v1.CaPool]. + ENABLED = 1; + + // Certificates cannot be issued from this CA. CRLs will still be generated. + // The CA will be part of the [CaPool][google.cloud.security.privateca.v1.CaPool]'s trust anchor, but will not be + // used to issue certificates from the [CaPool][google.cloud.security.privateca.v1.CaPool]. + DISABLED = 2; + + // Certificates can be issued from this CA. CRLs will be generated for this + // CA. The CA will be part of the [CaPool][google.cloud.security.privateca.v1.CaPool]'s trust anchor, but will not + // be used to issue certificates from the [CaPool][google.cloud.security.privateca.v1.CaPool]. + STAGED = 3; + + // Certificates cannot be issued from this CA. CRLs will not be generated. + // The CA will not be part of the [CaPool][google.cloud.security.privateca.v1.CaPool]'s trust anchor, and will not be + // used to issue certificates from the [CaPool][google.cloud.security.privateca.v1.CaPool]. + AWAITING_USER_ACTIVATION = 4; + + // Certificates cannot be issued from this CA. CRLs will not be generated. + // The CA may still be recovered by calling + // [CertificateAuthorityService.UndeleteCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.UndeleteCertificateAuthority] before + // [expire_time][google.cloud.security.privateca.v1.CertificateAuthority.expire_time]. + // The CA will not be part of the [CaPool][google.cloud.security.privateca.v1.CaPool]'s trust anchor, and will not be + // used to issue certificates from the [CaPool][google.cloud.security.privateca.v1.CaPool]. + DELETED = 5; + } + + // URLs where a [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] will publish content. + message AccessUrls { + // The URL where this [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]'s CA certificate is + // published. This will only be set for CAs that have been activated. + string ca_certificate_access_url = 1; + + // The URLs where this [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]'s CRLs are published. This + // will only be set for CAs that have been activated. + repeated string crl_access_urls = 2; + } + + // A Cloud KMS key configuration that a [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] will use. + message KeyVersionSpec { + oneof KeyVersion { + // The resource name for an existing Cloud KMS CryptoKeyVersion in the + // format + // `projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*`. + // This option enables full flexibility in the key's capabilities and + // properties. + string cloud_kms_key_version = 1; + + // The algorithm to use for creating a managed Cloud KMS key for a for a + // simplified experience. All managed keys will be have their + // [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] as `HSM`. + SignHashAlgorithm algorithm = 2; + } + } + + // The algorithm of a Cloud KMS CryptoKeyVersion of a + // [CryptoKey][google.cloud.kms.v1.CryptoKey] with the + // [CryptoKeyPurpose][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose] value + // `ASYMMETRIC_SIGN`. These values correspond to the + // [CryptoKeyVersionAlgorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm] + // values. For RSA signing algorithms, the PSS algorithms should be preferred, + // use PKCS1 algorithms if required for compatibility. For further + // recommendations, see + // https://cloud.google.com/kms/docs/algorithms#algorithm_recommendations. + enum SignHashAlgorithm { + // Not specified. + SIGN_HASH_ALGORITHM_UNSPECIFIED = 0; + + // maps to CryptoKeyVersionAlgorithm.RSA_SIGN_PSS_2048_SHA256 + RSA_PSS_2048_SHA256 = 1; + + // maps to CryptoKeyVersionAlgorithm. RSA_SIGN_PSS_3072_SHA256 + RSA_PSS_3072_SHA256 = 2; + + // maps to CryptoKeyVersionAlgorithm.RSA_SIGN_PSS_4096_SHA256 + RSA_PSS_4096_SHA256 = 3; + + // maps to CryptoKeyVersionAlgorithm.RSA_SIGN_PKCS1_2048_SHA256 + RSA_PKCS1_2048_SHA256 = 6; + + // maps to CryptoKeyVersionAlgorithm.RSA_SIGN_PKCS1_3072_SHA256 + RSA_PKCS1_3072_SHA256 = 7; + + // maps to CryptoKeyVersionAlgorithm.RSA_SIGN_PKCS1_4096_SHA256 + RSA_PKCS1_4096_SHA256 = 8; + + // maps to CryptoKeyVersionAlgorithm.EC_SIGN_P256_SHA256 + EC_P256_SHA256 = 4; + + // maps to CryptoKeyVersionAlgorithm.EC_SIGN_P384_SHA384 + EC_P384_SHA384 = 5; + } + + // Output only. The resource name for this [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] in the + // format `projects/*/locations/*/caPools/*/certificateAuthorities/*`. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. Immutable. The [Type][google.cloud.security.privateca.v1.CertificateAuthority.Type] of this [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. + Type type = 2 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = IMMUTABLE + ]; + + // Required. Immutable. The config used to create a self-signed X.509 certificate or CSR. + CertificateConfig config = 3 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = IMMUTABLE + ]; + + // Required. Immutable. The desired lifetime of the CA certificate. Used to create the + // "not_before_time" and "not_after_time" fields inside an X.509 + // certificate. + google.protobuf.Duration lifetime = 4 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = IMMUTABLE + ]; + + // Required. Immutable. Used when issuing certificates for this [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. If this + // [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] is a self-signed CertificateAuthority, this key + // is also used to sign the self-signed CA certificate. Otherwise, it + // is used to sign a CSR. + KeyVersionSpec key_spec = 5 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = IMMUTABLE + ]; + + // Optional. If this is a subordinate [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority], this field will be set + // with the subordinate configuration, which describes its issuers. This may + // be updated, but this [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] must continue to validate. + SubordinateConfig subordinate_config = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The [CaPool.Tier][google.cloud.security.privateca.v1.CaPool.Tier] of the [CaPool][google.cloud.security.privateca.v1.CaPool] that includes this + // [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. + CaPool.Tier tier = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The [State][google.cloud.security.privateca.v1.CertificateAuthority.State] for this [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. + State state = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. This [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]'s certificate chain, including the current + // [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]'s certificate. Ordered such that the root issuer + // is the final element (consistent with RFC 5246). For a self-signed CA, this + // will only list the current [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]'s certificate. + repeated string pem_ca_certificates = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. A structured description of this [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]'s CA certificate + // and its issuers. Ordered as self-to-root. + repeated CertificateDescription ca_certificate_descriptions = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Immutable. The name of a Cloud Storage bucket where this [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] will + // publish content, such as the CA certificate and CRLs. This must be a bucket + // name, without any prefixes (such as `gs://`) or suffixes (such as + // `.googleapis.com`). For example, to use a bucket named `my-bucket`, you + // would simply specify `my-bucket`. If not specified, a managed bucket will + // be created. + string gcs_bucket = 11 [(google.api.field_behavior) = IMMUTABLE]; + + // Output only. URLs for accessing content published by this CA, such as the CA certificate + // and CRLs. + AccessUrls access_urls = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which this [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] was created. + google.protobuf.Timestamp create_time = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which this [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] was last updated. + google.protobuf.Timestamp update_time = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which this [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] was soft deleted, if + // it is in the [DELETED][google.cloud.security.privateca.v1.CertificateAuthority.State.DELETED] state. + google.protobuf.Timestamp delete_time = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which this [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] will be permanently purged, + // if it is in the [DELETED][google.cloud.security.privateca.v1.CertificateAuthority.State.DELETED] state. + google.protobuf.Timestamp expire_time = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Labels with user-defined metadata. + map labels = 17 [(google.api.field_behavior) = OPTIONAL]; +} + +// A [CaPool][google.cloud.security.privateca.v1.CaPool] represents a group of +// [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority] that form a trust anchor. A +// [CaPool][google.cloud.security.privateca.v1.CaPool] can be used to manage issuance policies for one or more +// [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] resources and to rotate CA certificates in and out +// of the trust anchor. +message CaPool { + option (google.api.resource) = { + type: "privateca.googleapis.com/CaPool" + pattern: "projects/{project}/locations/{location}/caPools/{ca_pool}" + }; + + // The tier of a [CaPool][google.cloud.security.privateca.v1.CaPool], indicating its supported functionality and/or + // billing SKU. + enum Tier { + // Not specified. + TIER_UNSPECIFIED = 0; + + // Enterprise tier. + ENTERPRISE = 1; + + // DevOps tier. + DEVOPS = 2; + } + + // Options relating to the publication of each [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]'s CA + // certificate and CRLs and their inclusion as extensions in issued + // [Certificates][google.cloud.security.privateca.v1.Certificate]. The options set here apply to certificates + // issued by any [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] in the [CaPool][google.cloud.security.privateca.v1.CaPool]. + message PublishingOptions { + // Optional. When true, publishes each [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]'s CA certificate and + // includes its URL in the "Authority Information Access" X.509 extension + // in all issued [Certificates][google.cloud.security.privateca.v1.Certificate]. If this is false, the CA + // certificate will not be published and the corresponding X.509 extension + // will not be written in issued certificates. + bool publish_ca_cert = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. When true, publishes each [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]'s CRL and includes its + // URL in the "CRL Distribution Points" X.509 extension in all issued + // [Certificates][google.cloud.security.privateca.v1.Certificate]. If this is false, CRLs will not be published + // and the corresponding X.509 extension will not be written in issued + // certificates. + // CRLs will expire 7 days from their creation. However, we will rebuild + // daily. CRLs are also rebuilt shortly after a certificate is revoked. + bool publish_crl = 2 [(google.api.field_behavior) = OPTIONAL]; + } + + // Defines controls over all certificate issuance within a [CaPool][google.cloud.security.privateca.v1.CaPool]. + message IssuancePolicy { + // Describes a "type" of key that may be used in a [Certificate][google.cloud.security.privateca.v1.Certificate] issued + // from a [CaPool][google.cloud.security.privateca.v1.CaPool]. + // Note that a single [AllowedKeyType][google.cloud.security.privateca.v1.CaPool.IssuancePolicy.AllowedKeyType] may refer to either a + // fully-qualified key algorithm, such as RSA 4096, or a family of key + // algorithms, such as any RSA key. + message AllowedKeyType { + // Describes an RSA key that may be used in a [Certificate][google.cloud.security.privateca.v1.Certificate] issued from + // a [CaPool][google.cloud.security.privateca.v1.CaPool]. + message RsaKeyType { + // Optional. The minimum allowed RSA modulus size (inclusive), in bits. If this is + // not set, or if set to zero, the service-level min RSA modulus size + // will continue to apply. + int64 min_modulus_size = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The maximum allowed RSA modulus size (inclusive), in bits. If this is + // not set, or if set to zero, the service will not enforce an explicit + // upper bound on RSA modulus sizes. + int64 max_modulus_size = 2 [(google.api.field_behavior) = OPTIONAL]; + } + + // Describes an Elliptic Curve key that may be used in a [Certificate][google.cloud.security.privateca.v1.Certificate] + // issued from a [CaPool][google.cloud.security.privateca.v1.CaPool]. + message EcKeyType { + // Describes an elliptic curve-based signature algorithm that may be + // used in a [Certificate][google.cloud.security.privateca.v1.Certificate] issued from a [CaPool][google.cloud.security.privateca.v1.CaPool]. + enum EcSignatureAlgorithm { + // Not specified. Signifies that any signature algorithm may be used. + EC_SIGNATURE_ALGORITHM_UNSPECIFIED = 0; + + // Refers to the Elliptic Curve Digital Signature Algorithm over the + // NIST P-256 curve. + ECDSA_P256 = 1; + + // Refers to the Elliptic Curve Digital Signature Algorithm over the + // NIST P-384 curve. + ECDSA_P384 = 2; + + // Refers to the Edwards-curve Digital Signature Algorithm over curve + // 25519, as described in RFC 8410. + EDDSA_25519 = 3; + } + + // Optional. A signature algorithm that must be used. If this is omitted, any + // EC-based signature algorithm will be allowed. + EcSignatureAlgorithm signature_algorithm = 1 [(google.api.field_behavior) = OPTIONAL]; + } + + oneof key_type { + // Represents an allowed RSA key type. + RsaKeyType rsa = 1; + + // Represents an allowed Elliptic Curve key type. + EcKeyType elliptic_curve = 2; + } + } + + // [IssuanceModes][google.cloud.security.privateca.v1.CaPool.IssuancePolicy.IssuanceModes] specifies the allowed ways in which + // [Certificates][google.cloud.security.privateca.v1.Certificate] may be requested from this + // [CaPool][google.cloud.security.privateca.v1.CaPool]. + message IssuanceModes { + // Optional. When true, allows callers to create [Certificates][google.cloud.security.privateca.v1.Certificate] by + // specifying a CSR. + bool allow_csr_based_issuance = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. When true, allows callers to create [Certificates][google.cloud.security.privateca.v1.Certificate] by + // specifying a [CertificateConfig][google.cloud.security.privateca.v1.CertificateConfig]. + bool allow_config_based_issuance = 2 [(google.api.field_behavior) = OPTIONAL]; + } + + // Optional. If any [AllowedKeyType][google.cloud.security.privateca.v1.CaPool.IssuancePolicy.AllowedKeyType] is specified, then the certificate request's + // public key must match one of the key types listed here. Otherwise, + // any key may be used. + repeated AllowedKeyType allowed_key_types = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The maximum lifetime allowed for issued [Certificates][google.cloud.security.privateca.v1.Certificate]. Note + // that if the issuing [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] expires before a + // [Certificate][google.cloud.security.privateca.v1.Certificate]'s requested maximum_lifetime, the effective lifetime will + // be explicitly truncated to match it. + google.protobuf.Duration maximum_lifetime = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If specified, then only methods allowed in the [IssuanceModes][google.cloud.security.privateca.v1.CaPool.IssuancePolicy.IssuanceModes] may be + // used to issue [Certificates][google.cloud.security.privateca.v1.Certificate]. + IssuanceModes allowed_issuance_modes = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A set of X.509 values that will be applied to all certificates issued + // through this [CaPool][google.cloud.security.privateca.v1.CaPool]. If a certificate request includes conflicting + // values for the same properties, they will be overwritten by the values + // defined here. If a certificate request uses a [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] + // that defines conflicting + // [predefined_values][google.cloud.security.privateca.v1.CertificateTemplate.predefined_values] for the same + // properties, the certificate issuance request will fail. + X509Parameters baseline_values = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Describes constraints on identities that may appear in + // [Certificates][google.cloud.security.privateca.v1.Certificate] issued through this [CaPool][google.cloud.security.privateca.v1.CaPool]. + // If this is omitted, then this [CaPool][google.cloud.security.privateca.v1.CaPool] will not add restrictions on a + // certificate's identity. + CertificateIdentityConstraints identity_constraints = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Describes the set of X.509 extensions that may appear in a + // [Certificate][google.cloud.security.privateca.v1.Certificate] issued through this [CaPool][google.cloud.security.privateca.v1.CaPool]. If a certificate request + // sets extensions that don't appear in the [passthrough_extensions][google.cloud.security.privateca.v1.CaPool.IssuancePolicy.passthrough_extensions], + // those extensions will be dropped. If a certificate request uses a + // [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] with + // [predefined_values][google.cloud.security.privateca.v1.CertificateTemplate.predefined_values] that don't + // appear here, the certificate issuance request will fail. If this is + // omitted, then this [CaPool][google.cloud.security.privateca.v1.CaPool] will not add restrictions on a + // certificate's X.509 extensions. These constraints do not apply to X.509 + // extensions set in this [CaPool][google.cloud.security.privateca.v1.CaPool]'s [baseline_values][google.cloud.security.privateca.v1.CaPool.IssuancePolicy.baseline_values]. + CertificateExtensionConstraints passthrough_extensions = 6 [(google.api.field_behavior) = OPTIONAL]; + } + + // Output only. The resource name for this [CaPool][google.cloud.security.privateca.v1.CaPool] in the + // format `projects/*/locations/*/caPools/*`. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. Immutable. The [Tier][google.cloud.security.privateca.v1.CaPool.Tier] of this [CaPool][google.cloud.security.privateca.v1.CaPool]. + Tier tier = 2 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = IMMUTABLE + ]; + + // Optional. The [IssuancePolicy][google.cloud.security.privateca.v1.CaPool.IssuancePolicy] to control how [Certificates][google.cloud.security.privateca.v1.Certificate] + // will be issued from this [CaPool][google.cloud.security.privateca.v1.CaPool]. + IssuancePolicy issuance_policy = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The [PublishingOptions][google.cloud.security.privateca.v1.CaPool.PublishingOptions] to follow when issuing + // [Certificates][google.cloud.security.privateca.v1.Certificate] from any [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] in this + // [CaPool][google.cloud.security.privateca.v1.CaPool]. + PublishingOptions publishing_options = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Labels with user-defined metadata. + map labels = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// A [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList] corresponds to a signed X.509 certificate +// Revocation List (CRL). A CRL contains the serial numbers of certificates that +// should no longer be trusted. +message CertificateRevocationList { + option (google.api.resource) = { + type: "privateca.googleapis.com/CertificateRevocationList" + pattern: "projects/{project}/locations/{location}/caPools/{ca_pool}/certificateAuthorities/{certificate_authority}/certificateRevocationLists/{certificate_revocation_list}" + }; + + // Describes a revoked [Certificate][google.cloud.security.privateca.v1.Certificate]. + message RevokedCertificate { + // The resource name for the [Certificate][google.cloud.security.privateca.v1.Certificate] in the format + // `projects/*/locations/*/caPools/*/certificates/*`. + string certificate = 1 [(google.api.resource_reference) = { + type: "privateca.googleapis.com/Certificate" + }]; + + // The serial number of the [Certificate][google.cloud.security.privateca.v1.Certificate]. + string hex_serial_number = 2; + + // The reason the [Certificate][google.cloud.security.privateca.v1.Certificate] was revoked. + RevocationReason revocation_reason = 3; + } + + // The state of a [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList], indicating if it is current. + enum State { + // Not specified. + STATE_UNSPECIFIED = 0; + + // The [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList] is up to date. + ACTIVE = 1; + + // The [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList] is no longer current. + SUPERSEDED = 2; + } + + // Output only. The resource name for this [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList] in + // the format + // `projects/*/locations/*/caPools/*certificateAuthorities/*/ + // certificateRevocationLists/*`. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The CRL sequence number that appears in pem_crl. + int64 sequence_number = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The revoked serial numbers that appear in pem_crl. + repeated RevokedCertificate revoked_certificates = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The PEM-encoded X.509 CRL. + string pem_crl = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The location where 'pem_crl' can be accessed. + string access_url = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The [State][google.cloud.security.privateca.v1.CertificateRevocationList.State] for this [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList]. + State state = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which this [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList] was created. + google.protobuf.Timestamp create_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which this [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList] was updated. + google.protobuf.Timestamp update_time = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The revision ID of this [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList]. A new revision is + // committed whenever a new CRL is published. The format is an 8-character + // hexadecimal string. + string revision_id = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Labels with user-defined metadata. + map labels = 10 [(google.api.field_behavior) = OPTIONAL]; +} + +// A [Certificate][google.cloud.security.privateca.v1.Certificate] corresponds to a signed X.509 certificate issued by a +// [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. +message Certificate { + option (google.api.resource) = { + type: "privateca.googleapis.com/Certificate" + pattern: "projects/{project}/locations/{location}/caPools/{ca_pool}/certificates/{certificate}" + }; + + // Describes fields that are relavent to the revocation of a [Certificate][google.cloud.security.privateca.v1.Certificate]. + message RevocationDetails { + // Indicates why a [Certificate][google.cloud.security.privateca.v1.Certificate] was revoked. + RevocationReason revocation_state = 1; + + // The time at which this [Certificate][google.cloud.security.privateca.v1.Certificate] was revoked. + google.protobuf.Timestamp revocation_time = 2; + } + + // Output only. The resource name for this [Certificate][google.cloud.security.privateca.v1.Certificate] in the format + // `projects/*/locations/*/caPools/*/certificates/*`. + string name = 1 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "privateca.googleapis.com/Certificate" + } + ]; + + // The config used to create a signed X.509 certificate. + oneof certificate_config { + // Immutable. A pem-encoded X.509 certificate signing request (CSR). + string pem_csr = 2 [(google.api.field_behavior) = IMMUTABLE]; + + // Immutable. A description of the certificate and key that does not require X.509 or + // ASN.1. + CertificateConfig config = 3 [(google.api.field_behavior) = IMMUTABLE]; + } + + // Output only. The resource name of the issuing [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] in the format + // `projects/*/locations/*/caPools/*/certificateAuthorities/*`. + string issuer_certificate_authority = 4 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "privateca.googleapis.com/CertificateAuthority" + } + ]; + + // Required. Immutable. The desired lifetime of a certificate. Used to create the + // "not_before_time" and "not_after_time" fields inside an X.509 + // certificate. Note that the lifetime may be truncated if it would extend + // past the life of any certificate authority in the issuing chain. + google.protobuf.Duration lifetime = 5 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = IMMUTABLE + ]; + + // Immutable. The resource name for a [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] used to issue this + // certificate, in the format + // `projects/*/locations/*/certificateTemplates/*`. + // If this is specified, the caller must have the necessary permission to + // use this template. If this is omitted, no template will be used. + // This template must be in the same location as the [Certificate][google.cloud.security.privateca.v1.Certificate]. + string certificate_template = 6 [ + (google.api.field_behavior) = IMMUTABLE, + (google.api.resource_reference) = { + type: "privateca.googleapis.com/CertificateTemplate" + } + ]; + + // Immutable. Specifies how the [Certificate][google.cloud.security.privateca.v1.Certificate]'s identity fields are to be decided. + // If this is omitted, the `DEFAULT` subject mode will be used. + SubjectRequestMode subject_mode = 7 [(google.api.field_behavior) = IMMUTABLE]; + + // Output only. Details regarding the revocation of this [Certificate][google.cloud.security.privateca.v1.Certificate]. This + // [Certificate][google.cloud.security.privateca.v1.Certificate] is considered revoked if and only if this field is present. + RevocationDetails revocation_details = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The pem-encoded, signed X.509 certificate. + string pem_certificate = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. A structured description of the issued X.509 certificate. + CertificateDescription certificate_description = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The chain that may be used to verify the X.509 certificate. Expected to be + // in issuer-to-root order according to RFC 5246. + repeated string pem_certificate_chain = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which this [Certificate][google.cloud.security.privateca.v1.Certificate] was created. + google.protobuf.Timestamp create_time = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which this [Certificate][google.cloud.security.privateca.v1.Certificate] was updated. + google.protobuf.Timestamp update_time = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Labels with user-defined metadata. + map labels = 14 [(google.api.field_behavior) = OPTIONAL]; +} + +// A [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] refers to a managed template for certificate +// issuance. +message CertificateTemplate { + option (google.api.resource) = { + type: "privateca.googleapis.com/CertificateTemplate" + pattern: "projects/{project}/locations/{location}/certificateTemplates/{certificate_template}" + }; + + // Output only. The resource name for this [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] in the format + // `projects/*/locations/*/certificateTemplates/*`. + string name = 1 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "privateca.googleapis.com/CertificateTemplate" + } + ]; + + // Optional. A set of X.509 values that will be applied to all issued certificates that + // use this template. If the certificate request includes conflicting values + // for the same properties, they will be overwritten by the values defined + // here. If the issuing [CaPool][google.cloud.security.privateca.v1.CaPool]'s [IssuancePolicy][google.cloud.security.privateca.v1.CaPool.IssuancePolicy] + // defines conflicting + // [baseline_values][google.cloud.security.privateca.v1.CaPool.IssuancePolicy.baseline_values] for the same + // properties, the certificate issuance request will fail. + X509Parameters predefined_values = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Describes constraints on identities that may be appear in + // [Certificates][google.cloud.security.privateca.v1.Certificate] issued using this template. If this is omitted, + // then this template will not add restrictions on a certificate's identity. + CertificateIdentityConstraints identity_constraints = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Describes the set of X.509 extensions that may appear in a + // [Certificate][google.cloud.security.privateca.v1.Certificate] issued using this [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate]. If a certificate + // request sets extensions that don't appear in the + // [passthrough_extensions][google.cloud.security.privateca.v1.CertificateTemplate.passthrough_extensions], those extensions will be dropped. If the + // issuing [CaPool][google.cloud.security.privateca.v1.CaPool]'s [IssuancePolicy][google.cloud.security.privateca.v1.CaPool.IssuancePolicy] defines + // [baseline_values][google.cloud.security.privateca.v1.CaPool.IssuancePolicy.baseline_values] that don't appear + // here, the certificate issuance request will fail. If this is omitted, then + // this template will not add restrictions on a certificate's X.509 + // extensions. These constraints do not apply to X.509 extensions set in this + // [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate]'s [predefined_values][google.cloud.security.privateca.v1.CertificateTemplate.predefined_values]. + CertificateExtensionConstraints passthrough_extensions = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A human-readable description of scenarios this template is intended for. + string description = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The time at which this [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] was created. + google.protobuf.Timestamp create_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which this [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] was updated. + google.protobuf.Timestamp update_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Labels with user-defined metadata. + map labels = 8 [(google.api.field_behavior) = OPTIONAL]; +} + +// An [X509Parameters][google.cloud.security.privateca.v1.X509Parameters] is used to describe certain fields of an +// X.509 certificate, such as the key usage fields, fields specific to CA +// certificates, certificate policy extensions and custom extensions. +message X509Parameters { + // Describes values that are relevant in a CA certificate. + message CaOptions { + // Optional. Refers to the "CA" X.509 extension, which is a boolean value. When this + // value is missing, the extension will be omitted from the CA certificate. + optional bool is_ca = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Refers to the path length restriction X.509 extension. For a CA + // certificate, this value describes the depth of subordinate CA + // certificates that are allowed. + // If this value is less than 0, the request will fail. + // If this value is missing, the max path length will be omitted from the + // CA certificate. + optional int32 max_issuer_path_length = 2 [(google.api.field_behavior) = OPTIONAL]; + } + + // Optional. Indicates the intended use for keys that correspond to a certificate. + KeyUsage key_usage = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Describes options in this [X509Parameters][google.cloud.security.privateca.v1.X509Parameters] that are relevant in a CA + // certificate. + CaOptions ca_options = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Describes the X.509 certificate policy object identifiers, per + // https://tools.ietf.org/html/rfc5280#section-4.2.1.4. + repeated ObjectId policy_ids = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Describes Online Certificate Status Protocol (OCSP) endpoint addresses + // that appear in the "Authority Information Access" extension in the + // certificate. + repeated string aia_ocsp_servers = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Describes custom X.509 extensions. + repeated X509Extension additional_extensions = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Describes a subordinate CA's issuers. This is either a resource name to a +// known issuing [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority], or a PEM issuer certificate chain. +message SubordinateConfig { + // This message describes a subordinate CA's issuer certificate chain. This + // wrapper exists for compatibility reasons. + message SubordinateConfigChain { + // Required. Expected to be in leaf-to-root order according to RFC 5246. + repeated string pem_certificates = 1 [(google.api.field_behavior) = REQUIRED]; + } + + oneof subordinate_config { + // Required. This can refer to a [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] that was used to create a + // subordinate [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. This field is used for information + // and usability purposes only. The resource name is in the format + // `projects/*/locations/*/caPools/*/certificateAuthorities/*`. + string certificate_authority = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "privateca.googleapis.com/CertificateAuthority" + } + ]; + + // Required. Contains the PEM certificate chain for the issuers of this + // [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority], but not pem certificate for this CA itself. + SubordinateConfigChain pem_issuer_chain = 2 [(google.api.field_behavior) = REQUIRED]; + } +} + +// A [PublicKey][google.cloud.security.privateca.v1.PublicKey] describes a public key. +message PublicKey { + // Types of public keys formats that are supported. Currently, only `PEM` + // format is supported. + enum KeyFormat { + // Default unspecified value. + KEY_FORMAT_UNSPECIFIED = 0; + + // The key is PEM-encoded as defined in [RFC + // 7468](https://tools.ietf.org/html/rfc7468). It can be any of the + // following: a PEM-encoded PKCS#1/RFC 3447 RSAPublicKey + // structure, an RFC 5280 + // [SubjectPublicKeyInfo](https://tools.ietf.org/html/rfc5280#section-4.1) + // or a PEM-encoded X.509 certificate signing request (CSR). If a + // [SubjectPublicKeyInfo](https://tools.ietf.org/html/rfc5280#section-4.1) + // is specified, it can contain a A PEM-encoded PKCS#1/RFC 3447 RSAPublicKey + // or a NIST P-256/secp256r1/prime256v1 or P-384 key. If a CSR is specified, + // it will used solely for the purpose of extracting the public key. When + // generated by the service, it will always be an RFC 5280 + // [SubjectPublicKeyInfo](https://tools.ietf.org/html/rfc5280#section-4.1) + // structure containing an algorithm identifier and a key. + PEM = 1; + } + + // Required. A public key. The padding and encoding + // must match with the `KeyFormat` value specified for the `format` field. + bytes key = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The format of the public key. + KeyFormat format = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// A [CertificateConfig][google.cloud.security.privateca.v1.CertificateConfig] describes an X.509 certificate or CSR that is to be +// created, as an alternative to using ASN.1. +message CertificateConfig { + // These values are used to create the distinguished name and subject + // alternative name fields in an X.509 certificate. + message SubjectConfig { + // Required. Contains distinguished name fields such as the common name, location and + // organization. + Subject subject = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The subject alternative name fields. + SubjectAltNames subject_alt_name = 2 [(google.api.field_behavior) = OPTIONAL]; + } + + // Required. Specifies some of the values in a certificate that are related to the + // subject. + SubjectConfig subject_config = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Describes how some of the technical X.509 fields in a certificate should be + // populated. + X509Parameters x509_config = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The public key that corresponds to this config. This is, for example, used + // when issuing [Certificates][google.cloud.security.privateca.v1.Certificate], but not when creating a + // self-signed [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] or [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] CSR. + PublicKey public_key = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// A [CertificateDescription][google.cloud.security.privateca.v1.CertificateDescription] describes an X.509 certificate or CSR that has +// been issued, as an alternative to using ASN.1 / X.509. +message CertificateDescription { + // These values describe fields in an issued X.509 certificate such as the + // distinguished name, subject alternative names, serial number, and lifetime. + message SubjectDescription { + // Contains distinguished name fields such as the common name, location and + // / organization. + Subject subject = 1; + + // The subject alternative name fields. + SubjectAltNames subject_alt_name = 2; + + // The serial number encoded in lowercase hexadecimal. + string hex_serial_number = 3; + + // For convenience, the actual lifetime of an issued certificate. + google.protobuf.Duration lifetime = 4; + + // The time at which the certificate becomes valid. + google.protobuf.Timestamp not_before_time = 5; + + // The time after which the certificate is expired. + // Per RFC 5280, the validity period for a certificate is the period of time + // from not_before_time through not_after_time, inclusive. + // Corresponds to 'not_before_time' + 'lifetime' - 1 second. + google.protobuf.Timestamp not_after_time = 6; + } + + // A KeyId identifies a specific public key, usually by hashing the public + // key. + message KeyId { + // Optional. The value of this KeyId encoded in lowercase hexadecimal. This is most + // likely the 160 bit SHA-1 hash of the public key. + string key_id = 1 [(google.api.field_behavior) = OPTIONAL]; + } + + // A group of fingerprints for the x509 certificate. + message CertificateFingerprint { + // The SHA 256 hash, encoded in hexadecimal, of the DER x509 certificate. + string sha256_hash = 1; + } + + // Describes some of the values in a certificate that are related to the + // subject and lifetime. + SubjectDescription subject_description = 1; + + // Describes some of the technical X.509 fields in a certificate. + X509Parameters x509_description = 2; + + // The public key that corresponds to an issued certificate. + PublicKey public_key = 3; + + // Provides a means of identifiying certificates that contain a particular + // public key, per https://tools.ietf.org/html/rfc5280#section-4.2.1.2. + KeyId subject_key_id = 4; + + // Identifies the subject_key_id of the parent certificate, per + // https://tools.ietf.org/html/rfc5280#section-4.2.1.1 + KeyId authority_key_id = 5; + + // Describes a list of locations to obtain CRL information, i.e. + // the DistributionPoint.fullName described by + // https://tools.ietf.org/html/rfc5280#section-4.2.1.13 + repeated string crl_distribution_points = 6; + + // Describes lists of issuer CA certificate URLs that appear in the + // "Authority Information Access" extension in the certificate. + repeated string aia_issuing_certificate_urls = 7; + + // The hash of the x.509 certificate. + CertificateFingerprint cert_fingerprint = 8; +} + +// An [ObjectId][google.cloud.security.privateca.v1.ObjectId] specifies an object identifier (OID). These provide context +// and describe types in ASN.1 messages. +message ObjectId { + // Required. The parts of an OID path. The most significant parts of the path come + // first. + repeated int32 object_id_path = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// An [X509Extension][google.cloud.security.privateca.v1.X509Extension] specifies an X.509 extension, which may be used in +// different parts of X.509 objects like certificates, CSRs, and CRLs. +message X509Extension { + // Required. The OID for this X.509 extension. + ObjectId object_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Indicates whether or not this extension is critical (i.e., if the client + // does not know how to handle this extension, the client should consider this + // to be an error). + bool critical = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The value of this X.509 extension. + bytes value = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// A [KeyUsage][google.cloud.security.privateca.v1.KeyUsage] describes key usage values that may appear in an X.509 +// certificate. +message KeyUsage { + // [KeyUsage.KeyUsageOptions][google.cloud.security.privateca.v1.KeyUsage.KeyUsageOptions] corresponds to the key usage values + // described in https://tools.ietf.org/html/rfc5280#section-4.2.1.3. + message KeyUsageOptions { + // The key may be used for digital signatures. + bool digital_signature = 1; + + // The key may be used for cryptographic commitments. Note that this may + // also be referred to as "non-repudiation". + bool content_commitment = 2; + + // The key may be used to encipher other keys. + bool key_encipherment = 3; + + // The key may be used to encipher data. + bool data_encipherment = 4; + + // The key may be used in a key agreement protocol. + bool key_agreement = 5; + + // The key may be used to sign certificates. + bool cert_sign = 6; + + // The key may be used sign certificate revocation lists. + bool crl_sign = 7; + + // The key may be used to encipher only. + bool encipher_only = 8; + + // The key may be used to decipher only. + bool decipher_only = 9; + } + + // [KeyUsage.ExtendedKeyUsageOptions][google.cloud.security.privateca.v1.KeyUsage.ExtendedKeyUsageOptions] has fields that correspond to + // certain common OIDs that could be specified as an extended key usage value. + message ExtendedKeyUsageOptions { + // Corresponds to OID 1.3.6.1.5.5.7.3.1. Officially described as "TLS WWW + // server authentication", though regularly used for non-WWW TLS. + bool server_auth = 1; + + // Corresponds to OID 1.3.6.1.5.5.7.3.2. Officially described as "TLS WWW + // client authentication", though regularly used for non-WWW TLS. + bool client_auth = 2; + + // Corresponds to OID 1.3.6.1.5.5.7.3.3. Officially described as "Signing of + // downloadable executable code client authentication". + bool code_signing = 3; + + // Corresponds to OID 1.3.6.1.5.5.7.3.4. Officially described as "Email + // protection". + bool email_protection = 4; + + // Corresponds to OID 1.3.6.1.5.5.7.3.8. Officially described as "Binding + // the hash of an object to a time". + bool time_stamping = 5; + + // Corresponds to OID 1.3.6.1.5.5.7.3.9. Officially described as "Signing + // OCSP responses". + bool ocsp_signing = 6; + } + + // Describes high-level ways in which a key may be used. + KeyUsageOptions base_key_usage = 1; + + // Detailed scenarios in which a key may be used. + ExtendedKeyUsageOptions extended_key_usage = 2; + + // Used to describe extended key usages that are not listed in the + // [KeyUsage.ExtendedKeyUsageOptions][google.cloud.security.privateca.v1.KeyUsage.ExtendedKeyUsageOptions] message. + repeated ObjectId unknown_extended_key_usages = 3; +} + +// [Subject][google.cloud.security.privateca.v1.Subject] describes parts of a distinguished name that, in turn, +// describes the subject of the certificate. +message Subject { + // The "common name" of the subject. + string common_name = 1; + + // The country code of the subject. + string country_code = 2; + + // The organization of the subject. + string organization = 3; + + // The organizational_unit of the subject. + string organizational_unit = 4; + + // The locality or city of the subject. + string locality = 5; + + // The province, territory, or regional state of the subject. + string province = 6; + + // The street address of the subject. + string street_address = 7; + + // The postal code of the subject. + string postal_code = 8; +} + +// [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] corresponds to a more modern way of listing what +// the asserted identity is in a certificate (i.e., compared to the "common +// name" in the distinguished name). +message SubjectAltNames { + // Contains only valid, fully-qualified host names. + repeated string dns_names = 1; + + // Contains only valid RFC 3986 URIs. + repeated string uris = 2; + + // Contains only valid RFC 2822 E-mail addresses. + repeated string email_addresses = 3; + + // Contains only valid 32-bit IPv4 addresses or RFC 4291 IPv6 addresses. + repeated string ip_addresses = 4; + + // Contains additional subject alternative name values. + // For each custom_san, the `value` field must contain an ASN.1 encoded + // UTF8String. + repeated X509Extension custom_sans = 5; +} + +// Describes constraints on a [Certificate][google.cloud.security.privateca.v1.Certificate]'s [Subject][google.cloud.security.privateca.v1.Subject] and +// [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames]. +message CertificateIdentityConstraints { + // Optional. A CEL expression that may be used to validate the resolved X.509 Subject + // and/or Subject Alternative Name before a certificate is signed. + // To see the full allowed syntax and some examples, see + // https://cloud.google.com/certificate-authority-service/docs/using-cel + google.type.Expr cel_expression = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Required. If this is true, the [Subject][google.cloud.security.privateca.v1.Subject] field may be copied from a certificate + // request into the signed certificate. Otherwise, the requested [Subject][google.cloud.security.privateca.v1.Subject] + // will be discarded. + optional bool allow_subject_passthrough = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. If this is true, the [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] extension may be copied from a + // certificate request into the signed certificate. Otherwise, the requested + // [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] will be discarded. + optional bool allow_subject_alt_names_passthrough = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Describes a set of X.509 extensions that may be part of some certificate +// issuance controls. +message CertificateExtensionConstraints { + // Describes well-known X.509 extensions that can appear in a [Certificate][google.cloud.security.privateca.v1.Certificate], + // not including the [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] extension. + enum KnownCertificateExtension { + // Not specified. + KNOWN_CERTIFICATE_EXTENSION_UNSPECIFIED = 0; + + // Refers to a certificate's Key Usage extension, as described in [RFC 5280 + // section 4.2.1.3](https://tools.ietf.org/html/rfc5280#section-4.2.1.3). + // This corresponds to the [KeyUsage.base_key_usage][google.cloud.security.privateca.v1.KeyUsage.base_key_usage] field. + BASE_KEY_USAGE = 1; + + // Refers to a certificate's Extended Key Usage extension, as described in + // [RFC 5280 + // section 4.2.1.12](https://tools.ietf.org/html/rfc5280#section-4.2.1.12). + // This corresponds to the [KeyUsage.extended_key_usage][google.cloud.security.privateca.v1.KeyUsage.extended_key_usage] message. + EXTENDED_KEY_USAGE = 2; + + // Refers to a certificate's Basic Constraints extension, as described in + // [RFC 5280 + // section 4.2.1.9](https://tools.ietf.org/html/rfc5280#section-4.2.1.9). + // This corresponds to the [X509Parameters.ca_options][google.cloud.security.privateca.v1.X509Parameters.ca_options] field. + CA_OPTIONS = 3; + + // Refers to a certificate's Policy object identifiers, as described in + // [RFC 5280 + // section 4.2.1.4](https://tools.ietf.org/html/rfc5280#section-4.2.1.4). + // This corresponds to the [X509Parameters.policy_ids][google.cloud.security.privateca.v1.X509Parameters.policy_ids] field. + POLICY_IDS = 4; + + // Refers to OCSP servers in a certificate's Authority Information Access + // extension, as described in + // [RFC 5280 + // section 4.2.2.1](https://tools.ietf.org/html/rfc5280#section-4.2.2.1), + // This corresponds to the [X509Parameters.aia_ocsp_servers][google.cloud.security.privateca.v1.X509Parameters.aia_ocsp_servers] field. + AIA_OCSP_SERVERS = 5; + } + + // Optional. A set of named X.509 extensions. Will be combined with + // [additional_extensions][google.cloud.security.privateca.v1.CertificateExtensionConstraints.additional_extensions] to determine the full set of X.509 extensions. + repeated KnownCertificateExtension known_extensions = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A set of [ObjectIds][google.cloud.security.privateca.v1.ObjectId] identifying custom X.509 extensions. + // Will be combined with [known_extensions][google.cloud.security.privateca.v1.CertificateExtensionConstraints.known_extensions] to determine the full set of + // X.509 extensions. + repeated ObjectId additional_extensions = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// A [RevocationReason][google.cloud.security.privateca.v1.RevocationReason] indicates whether a [Certificate][google.cloud.security.privateca.v1.Certificate] has been revoked, +// and the reason for revocation. These correspond to standard revocation +// reasons from RFC 5280. Note that the enum labels and values in this +// definition are not the same ASN.1 values defined in RFC 5280. These values +// will be translated to the correct ASN.1 values when a CRL is created. +enum RevocationReason { + // Default unspecified value. This value does indicate that a [Certificate][google.cloud.security.privateca.v1.Certificate] + // has been revoked, but that a reason has not been recorded. + REVOCATION_REASON_UNSPECIFIED = 0; + + // Key material for this [Certificate][google.cloud.security.privateca.v1.Certificate] may have leaked. + KEY_COMPROMISE = 1; + + // The key material for a certificate authority in the issuing path may have + // leaked. + CERTIFICATE_AUTHORITY_COMPROMISE = 2; + + // The subject or other attributes in this [Certificate][google.cloud.security.privateca.v1.Certificate] have changed. + AFFILIATION_CHANGED = 3; + + // This [Certificate][google.cloud.security.privateca.v1.Certificate] has been superseded. + SUPERSEDED = 4; + + // This [Certificate][google.cloud.security.privateca.v1.Certificate] or entities in the issuing path have ceased to + // operate. + CESSATION_OF_OPERATION = 5; + + // This [Certificate][google.cloud.security.privateca.v1.Certificate] should not be considered valid, it is expected that it + // may become valid in the future. + CERTIFICATE_HOLD = 6; + + // This [Certificate][google.cloud.security.privateca.v1.Certificate] no longer has permission to assert the listed + // attributes. + PRIVILEGE_WITHDRAWN = 7; + + // The authority which determines appropriate attributes for a [Certificate][google.cloud.security.privateca.v1.Certificate] + // may have been compromised. + ATTRIBUTE_AUTHORITY_COMPROMISE = 8; +} + +// Describes the way in which a [Certificate][google.cloud.security.privateca.v1.Certificate]'s [Subject][google.cloud.security.privateca.v1.Subject] and/or +// [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] will be resolved. +enum SubjectRequestMode { + // Not specified. + SUBJECT_REQUEST_MODE_UNSPECIFIED = 0; + + // The default mode used in most cases. Indicates that the certificate's + // [Subject][google.cloud.security.privateca.v1.Subject] and/or [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] are specified in the certificate + // request. This mode requires the caller to have the + // `privateca.certificates.create` permission. + DEFAULT = 1; + + // A mode reserved for special cases. Indicates that the certificate should + // have one or more SPIFFE [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] set by the service based + // on the caller's identity. This mode will ignore any explicitly specified + // [Subject][google.cloud.security.privateca.v1.Subject] and/or [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] in the certificate request. + // This mode requires the caller to have the + // `privateca.certificates.createForSelf` permission. + REFLECTED_SPIFFE = 2; +} diff --git a/owl-bot-staging/v1/protos/google/cloud/security/privateca/v1/service.proto b/owl-bot-staging/v1/protos/google/cloud/security/privateca/v1/service.proto new file mode 100644 index 0000000..2ab5953 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/security/privateca/v1/service.proto @@ -0,0 +1,1277 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.security.privateca.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/security/privateca/v1/resources.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Security.PrivateCA.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/security/privateca/v1;privateca"; +option java_multiple_files = true; +option java_outer_classname = "PrivateCaProto"; +option java_package = "com.google.cloud.security.privateca.v1"; +option php_namespace = "Google\\Cloud\\Security\\PrivateCA\\V1"; +option ruby_package = "Google::Cloud::Security::PrivateCA::V1"; + +// [Certificate Authority Service][google.cloud.security.privateca.v1.CertificateAuthorityService] manages private +// certificate authorities and issued certificates. +service CertificateAuthorityService { + option (google.api.default_host) = "privateca.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Create a new [Certificate][google.cloud.security.privateca.v1.Certificate] in a given Project, Location from a particular + // [CaPool][google.cloud.security.privateca.v1.CaPool]. + rpc CreateCertificate(CreateCertificateRequest) returns (Certificate) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*/caPools/*}/certificates" + body: "certificate" + }; + option (google.api.method_signature) = "parent,certificate,certificate_id"; + } + + // Returns a [Certificate][google.cloud.security.privateca.v1.Certificate]. + rpc GetCertificate(GetCertificateRequest) returns (Certificate) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/caPools/*/certificates/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists [Certificates][google.cloud.security.privateca.v1.Certificate]. + rpc ListCertificates(ListCertificatesRequest) returns (ListCertificatesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/caPools/*}/certificates" + }; + option (google.api.method_signature) = "parent"; + } + + // Revoke a [Certificate][google.cloud.security.privateca.v1.Certificate]. + rpc RevokeCertificate(RevokeCertificateRequest) returns (Certificate) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/caPools/*/certificates/*}:revoke" + body: "*" + }; + option (google.api.method_signature) = "name"; + } + + // Update a [Certificate][google.cloud.security.privateca.v1.Certificate]. Currently, the only field you can update is the + // [labels][google.cloud.security.privateca.v1.Certificate.labels] field. + rpc UpdateCertificate(UpdateCertificateRequest) returns (Certificate) { + option (google.api.http) = { + patch: "/v1/{certificate.name=projects/*/locations/*/caPools/*/certificates/*}" + body: "certificate" + }; + option (google.api.method_signature) = "certificate,update_mask"; + } + + // Activate a [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] that is in state + // [AWAITING_USER_ACTIVATION][google.cloud.security.privateca.v1.CertificateAuthority.State.AWAITING_USER_ACTIVATION] + // and is of type [SUBORDINATE][google.cloud.security.privateca.v1.CertificateAuthority.Type.SUBORDINATE]. After + // the parent Certificate Authority signs a certificate signing request from + // [FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCertificateAuthorityCsr], this method can complete the activation + // process. + rpc ActivateCertificateAuthority(ActivateCertificateAuthorityRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/caPools/*/certificateAuthorities/*}:activate" + body: "*" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "CertificateAuthority" + metadata_type: "OperationMetadata" + }; + } + + // Create a new [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] in a given Project and Location. + rpc CreateCertificateAuthority(CreateCertificateAuthorityRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*/caPools/*}/certificateAuthorities" + body: "certificate_authority" + }; + option (google.api.method_signature) = "parent,certificate_authority,certificate_authority_id"; + option (google.longrunning.operation_info) = { + response_type: "CertificateAuthority" + metadata_type: "OperationMetadata" + }; + } + + // Disable a [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. + rpc DisableCertificateAuthority(DisableCertificateAuthorityRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/caPools/*/certificateAuthorities/*}:disable" + body: "*" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "CertificateAuthority" + metadata_type: "OperationMetadata" + }; + } + + // Enable a [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. + rpc EnableCertificateAuthority(EnableCertificateAuthorityRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/caPools/*/certificateAuthorities/*}:enable" + body: "*" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "CertificateAuthority" + metadata_type: "OperationMetadata" + }; + } + + // Fetch a certificate signing request (CSR) from a [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + // that is in state + // [AWAITING_USER_ACTIVATION][google.cloud.security.privateca.v1.CertificateAuthority.State.AWAITING_USER_ACTIVATION] + // and is of type [SUBORDINATE][google.cloud.security.privateca.v1.CertificateAuthority.Type.SUBORDINATE]. The + // CSR must then be signed by the desired parent Certificate Authority, which + // could be another [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] resource, or could be an on-prem + // certificate authority. See also [ActivateCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.ActivateCertificateAuthority]. + rpc FetchCertificateAuthorityCsr(FetchCertificateAuthorityCsrRequest) returns (FetchCertificateAuthorityCsrResponse) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/caPools/*/certificateAuthorities/*}:fetch" + }; + option (google.api.method_signature) = "name"; + } + + // Returns a [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. + rpc GetCertificateAuthority(GetCertificateAuthorityRequest) returns (CertificateAuthority) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/caPools/*/certificateAuthorities/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority]. + rpc ListCertificateAuthorities(ListCertificateAuthoritiesRequest) returns (ListCertificateAuthoritiesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/caPools/*}/certificateAuthorities" + }; + option (google.api.method_signature) = "parent"; + } + + // Undelete a [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] that has been deleted. + rpc UndeleteCertificateAuthority(UndeleteCertificateAuthorityRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/caPools/*/certificateAuthorities/*}:undelete" + body: "*" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "CertificateAuthority" + metadata_type: "OperationMetadata" + }; + } + + // Delete a [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. + rpc DeleteCertificateAuthority(DeleteCertificateAuthorityRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/caPools/*/certificateAuthorities/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "CertificateAuthority" + metadata_type: "OperationMetadata" + }; + } + + // Update a [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. + rpc UpdateCertificateAuthority(UpdateCertificateAuthorityRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{certificate_authority.name=projects/*/locations/*/caPools/*/certificateAuthorities/*}" + body: "certificate_authority" + }; + option (google.api.method_signature) = "certificate_authority,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "CertificateAuthority" + metadata_type: "OperationMetadata" + }; + } + + // Create a [CaPool][google.cloud.security.privateca.v1.CaPool]. + rpc CreateCaPool(CreateCaPoolRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/caPools" + body: "ca_pool" + }; + option (google.api.method_signature) = "parent,ca_pool,ca_pool_id"; + option (google.longrunning.operation_info) = { + response_type: "CaPool" + metadata_type: "OperationMetadata" + }; + } + + // Update a [CaPool][google.cloud.security.privateca.v1.CaPool]. + rpc UpdateCaPool(UpdateCaPoolRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{ca_pool.name=projects/*/locations/*/caPools/*}" + body: "ca_pool" + }; + option (google.api.method_signature) = "ca_pool,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "CaPool" + metadata_type: "OperationMetadata" + }; + } + + // Returns a [CaPool][google.cloud.security.privateca.v1.CaPool]. + rpc GetCaPool(GetCaPoolRequest) returns (CaPool) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/caPools/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists [CaPools][google.cloud.security.privateca.v1.CaPool]. + rpc ListCaPools(ListCaPoolsRequest) returns (ListCaPoolsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/caPools" + }; + option (google.api.method_signature) = "parent"; + } + + // Delete a [CaPool][google.cloud.security.privateca.v1.CaPool]. + rpc DeleteCaPool(DeleteCaPoolRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/caPools/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } + + // FetchCaCerts returns the current trust anchor for the [CaPool][google.cloud.security.privateca.v1.CaPool]. This will + // include CA certificate chains for all ACTIVE [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + // resources in the [CaPool][google.cloud.security.privateca.v1.CaPool]. + rpc FetchCaCerts(FetchCaCertsRequest) returns (FetchCaCertsResponse) { + option (google.api.http) = { + post: "/v1/{ca_pool=projects/*/locations/*/caPools/*}:fetchCaCerts" + body: "*" + }; + option (google.api.method_signature) = "ca_pool"; + } + + // Returns a [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList]. + rpc GetCertificateRevocationList(GetCertificateRevocationListRequest) returns (CertificateRevocationList) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/caPools/*/certificateAuthorities/*/certificateRevocationLists/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists [CertificateRevocationLists][google.cloud.security.privateca.v1.CertificateRevocationList]. + rpc ListCertificateRevocationLists(ListCertificateRevocationListsRequest) returns (ListCertificateRevocationListsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/caPools/*/certificateAuthorities/*}/certificateRevocationLists" + }; + option (google.api.method_signature) = "parent"; + } + + // Update a [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList]. + rpc UpdateCertificateRevocationList(UpdateCertificateRevocationListRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{certificate_revocation_list.name=projects/*/locations/*/caPools/*/certificateAuthorities/*/certificateRevocationLists/*}" + body: "certificate_revocation_list" + }; + option (google.api.method_signature) = "certificate_revocation_list,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "CertificateRevocationList" + metadata_type: "OperationMetadata" + }; + } + + // Create a new [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] in a given Project and Location. + rpc CreateCertificateTemplate(CreateCertificateTemplateRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/certificateTemplates" + body: "certificate_template" + }; + option (google.api.method_signature) = "parent,certificate_template,certificate_template_id"; + option (google.longrunning.operation_info) = { + response_type: "CertificateTemplate" + metadata_type: "OperationMetadata" + }; + } + + // DeleteCertificateTemplate deletes a [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate]. + rpc DeleteCertificateTemplate(DeleteCertificateTemplateRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/certificateTemplates/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.cloud.security.privateca.v1.OperationMetadata" + }; + } + + // Returns a [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate]. + rpc GetCertificateTemplate(GetCertificateTemplateRequest) returns (CertificateTemplate) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/certificateTemplates/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists [CertificateTemplates][google.cloud.security.privateca.v1.CertificateTemplate]. + rpc ListCertificateTemplates(ListCertificateTemplatesRequest) returns (ListCertificateTemplatesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/certificateTemplates" + }; + option (google.api.method_signature) = "parent"; + } + + // Update a [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate]. + rpc UpdateCertificateTemplate(UpdateCertificateTemplateRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{certificate_template.name=projects/*/locations/*/certificateTemplates/*}" + body: "certificate_template" + }; + option (google.api.method_signature) = "certificate_template,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "CertificateTemplate" + metadata_type: "OperationMetadata" + }; + } +} + +// Request message for [CertificateAuthorityService.CreateCertificate][google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCertificate]. +message CreateCertificateRequest { + // Required. The resource name of the [CaPool][google.cloud.security.privateca.v1.CaPool] associated with the [Certificate][google.cloud.security.privateca.v1.Certificate], + // in the format `projects/*/locations/*/caPools/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "privateca.googleapis.com/CaPool" + } + ]; + + // Optional. It must be unique within a location and match the regular + // expression `[a-zA-Z0-9_-]{1,63}`. This field is required when using a + // [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] in the Enterprise [CertificateAuthority.Tier][], + // but is optional and its value is ignored otherwise. + string certificate_id = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Required. A [Certificate][google.cloud.security.privateca.v1.Certificate] with initial field values. + Certificate certificate = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An ID to identify requests. Specify a unique request ID so that if you must + // retry your request, the server will know to ignore the request if it has + // already been completed. The server will guarantee that for at least 60 + // minutes since the first request. + // + // For example, consider a situation where you make an initial request and the + // request times out. If you make the request again with the same request ID, + // the server can check if original operation with the same request ID was + // received, and if so, will ignore the second request. This prevents clients + // from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If this is true, no [Certificate][google.cloud.security.privateca.v1.Certificate] resource will be persisted regardless + // of the [CaPool][google.cloud.security.privateca.v1.CaPool]'s [tier][google.cloud.security.privateca.v1.CaPool.tier], and the returned [Certificate][google.cloud.security.privateca.v1.Certificate] + // will not contain the [pem_certificate][google.cloud.security.privateca.v1.Certificate.pem_certificate] field. + bool validate_only = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The resource ID of the [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] that should issue the + // certificate. This optional field will ignore the load-balancing scheme of + // the Pool and directly issue the certificate from the CA with the specified + // ID, contained in the same [CaPool][google.cloud.security.privateca.v1.CaPool] referenced by `parent`. Per-CA quota + // rules apply. If left empty, a [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] will be chosen from + // the [CaPool][google.cloud.security.privateca.v1.CaPool] by the service. For example, to issue a [Certificate][google.cloud.security.privateca.v1.Certificate] from + // a Certificate Authority with resource name + // "projects/my-project/locations/us-central1/caPools/my-pool/certificateAuthorities/my-ca", + // you can set the [parent][google.cloud.security.privateca.v1.CreateCertificateRequest.parent] to + // "projects/my-project/locations/us-central1/caPools/my-pool" and the + // [issuing_certificate_authority_id][google.cloud.security.privateca.v1.CreateCertificateRequest.issuing_certificate_authority_id] to "my-ca". + string issuing_certificate_authority_id = 6 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [CertificateAuthorityService.GetCertificate][google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificate]. +message GetCertificateRequest { + // Required. The [name][google.cloud.security.privateca.v1.Certificate.name] of the [Certificate][google.cloud.security.privateca.v1.Certificate] to get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "privateca.googleapis.com/Certificate" + } + ]; +} + +// Request message for [CertificateAuthorityService.ListCertificates][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificates]. +message ListCertificatesRequest { + // Required. The resource name of the location associated with the + // [Certificates][google.cloud.security.privateca.v1.Certificate], in the format + // `projects/*/locations/*/caPools/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "privateca.googleapis.com/CaPool" + } + ]; + + // Optional. Limit on the number of + // [Certificates][google.cloud.security.privateca.v1.Certificate] to include in the + // response. Further [Certificates][google.cloud.security.privateca.v1.Certificate] can subsequently be obtained + // by including the + // [ListCertificatesResponse.next_page_token][google.cloud.security.privateca.v1.ListCertificatesResponse.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. Pagination token, returned earlier via + // [ListCertificatesResponse.next_page_token][google.cloud.security.privateca.v1.ListCertificatesResponse.next_page_token]. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Only include resources that match the filter in the response. For details + // on supported filters and syntax, see [Certificates Filtering + // documentation](https://cloud.google.com/certificate-authority-service/docs/sorting-filtering-certificates#filtering_support). + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specify how the results should be sorted. For details on supported fields + // and syntax, see [Certificates Sorting + // documentation](https://cloud.google.com/certificate-authority-service/docs/sorting-filtering-certificates#sorting_support). + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for [CertificateAuthorityService.ListCertificates][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificates]. +message ListCertificatesResponse { + // The list of [Certificates][google.cloud.security.privateca.v1.Certificate]. + repeated Certificate certificates = 1; + + // A token to retrieve next page of results. Pass this value in + // [ListCertificatesRequest.next_page_token][] to retrieve the + // next page of results. + string next_page_token = 2; + + // A list of locations (e.g. "us-west1") that could not be reached. + repeated string unreachable = 3; +} + +// Request message for +// [CertificateAuthorityService.RevokeCertificate][google.cloud.security.privateca.v1.CertificateAuthorityService.RevokeCertificate]. +message RevokeCertificateRequest { + // Required. The resource name for this [Certificate][google.cloud.security.privateca.v1.Certificate] in the + // format + // `projects/*/locations/*/caPools/*/certificates/*`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "privateca.googleapis.com/Certificate" + } + ]; + + // Required. The [RevocationReason][google.cloud.security.privateca.v1.RevocationReason] for revoking this certificate. + RevocationReason reason = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An ID to identify requests. Specify a unique request ID so that if you must + // retry your request, the server will know to ignore the request if it has + // already been completed. The server will guarantee that for at least 60 + // minutes since the first request. + // + // For example, consider a situation where you make an initial request and t + // he request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for [CertificateAuthorityService.UpdateCertificate][google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificate]. +message UpdateCertificateRequest { + // Required. [Certificate][google.cloud.security.privateca.v1.Certificate] with updated values. + Certificate certificate = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. A list of fields to be updated in this request. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An ID to identify requests. Specify a unique request ID so that if you must + // retry your request, the server will know to ignore the request if it has + // already been completed. The server will guarantee that for at least 60 + // minutes since the first request. + // + // For example, consider a situation where you make an initial request and t + // he request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [CertificateAuthorityService.ActivateCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.ActivateCertificateAuthority]. +message ActivateCertificateAuthorityRequest { + // Required. The resource name for this [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] in the + // format `projects/*/locations/*/caPools/*/certificateAuthorities/*`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "privateca.googleapis.com/CertificateAuthority" + } + ]; + + // Required. The signed CA certificate issued from + // [FetchCertificateAuthorityCsrResponse.pem_csr][google.cloud.security.privateca.v1.FetchCertificateAuthorityCsrResponse.pem_csr]. + string pem_ca_certificate = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Must include information about the issuer of 'pem_ca_certificate', and any + // further issuers until the self-signed CA. + SubordinateConfig subordinate_config = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An ID to identify requests. Specify a unique request ID so that if you must + // retry your request, the server will know to ignore the request if it has + // already been completed. The server will guarantee that for at least 60 + // minutes since the first request. + // + // For example, consider a situation where you make an initial request and t + // he request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [CertificateAuthorityService.CreateCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCertificateAuthority]. +message CreateCertificateAuthorityRequest { + // Required. The resource name of the [CaPool][google.cloud.security.privateca.v1.CaPool] associated with the + // [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority], in the format + // `projects/*/locations/*/caPools/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "privateca.googleapis.com/CaPool" + } + ]; + + // Required. It must be unique within a location and match the regular + // expression `[a-zA-Z0-9_-]{1,63}` + string certificate_authority_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. A [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] with initial field values. + CertificateAuthority certificate_authority = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An ID to identify requests. Specify a unique request ID so that if you must + // retry your request, the server will know to ignore the request if it has + // already been completed. The server will guarantee that for at least 60 + // minutes since the first request. + // + // For example, consider a situation where you make an initial request and t + // he request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [CertificateAuthorityService.DisableCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.DisableCertificateAuthority]. +message DisableCertificateAuthorityRequest { + // Required. The resource name for this [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] in the + // format `projects/*/locations/*/caPools/*/certificateAuthorities/*`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "privateca.googleapis.com/CertificateAuthority" + } + ]; + + // Optional. An ID to identify requests. Specify a unique request ID so that if you must + // retry your request, the server will know to ignore the request if it has + // already been completed. The server will guarantee that for at least 60 + // minutes since the first request. + // + // For example, consider a situation where you make an initial request and t + // he request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [CertificateAuthorityService.EnableCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.EnableCertificateAuthority]. +message EnableCertificateAuthorityRequest { + // Required. The resource name for this [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] in the + // format `projects/*/locations/*/caPools/*/certificateAuthorities/*`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "privateca.googleapis.com/CertificateAuthority" + } + ]; + + // Optional. An ID to identify requests. Specify a unique request ID so that if you must + // retry your request, the server will know to ignore the request if it has + // already been completed. The server will guarantee that for at least 60 + // minutes since the first request. + // + // For example, consider a situation where you make an initial request and t + // he request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [CertificateAuthorityService.FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCertificateAuthorityCsr]. +message FetchCertificateAuthorityCsrRequest { + // Required. The resource name for this [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] in the + // format `projects/*/locations/*/caPools/*/certificateAuthorities/*`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "privateca.googleapis.com/CertificateAuthority" + } + ]; +} + +// Response message for +// [CertificateAuthorityService.FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCertificateAuthorityCsr]. +message FetchCertificateAuthorityCsrResponse { + // Output only. The PEM-encoded signed certificate signing request (CSR). + string pem_csr = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Request message for [CertificateAuthorityService.GetCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificateAuthority]. +message GetCertificateAuthorityRequest { + // Required. The [name][google.cloud.security.privateca.v1.CertificateAuthority.name] of the [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] to + // get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "privateca.googleapis.com/CertificateAuthority" + } + ]; +} + +// Request message for +// [CertificateAuthorityService.ListCertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateAuthorities]. +message ListCertificateAuthoritiesRequest { + // Required. The resource name of the [CaPool][google.cloud.security.privateca.v1.CaPool] associated with the + // [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority], in the format + // `projects/*/locations/*/caPools/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "privateca.googleapis.com/CaPool" + } + ]; + + // Optional. Limit on the number of [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority] to + // include in the response. + // Further [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority] can subsequently be + // obtained by including the + // [ListCertificateAuthoritiesResponse.next_page_token][google.cloud.security.privateca.v1.ListCertificateAuthoritiesResponse.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. Pagination token, returned earlier via + // [ListCertificateAuthoritiesResponse.next_page_token][google.cloud.security.privateca.v1.ListCertificateAuthoritiesResponse.next_page_token]. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Only include resources that match the filter in the response. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specify how the results should be sorted. + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for +// [CertificateAuthorityService.ListCertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateAuthorities]. +message ListCertificateAuthoritiesResponse { + // The list of [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority]. + repeated CertificateAuthority certificate_authorities = 1; + + // A token to retrieve next page of results. Pass this value in + // [ListCertificateAuthoritiesRequest.next_page_token][] to retrieve the next + // page of results. + string next_page_token = 2; + + // A list of locations (e.g. "us-west1") that could not be reached. + repeated string unreachable = 3; +} + +// Request message for +// [CertificateAuthorityService.UndeleteCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.UndeleteCertificateAuthority]. +message UndeleteCertificateAuthorityRequest { + // Required. The resource name for this [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] in the + // format `projects/*/locations/*/caPools/*/certificateAuthorities/*`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "privateca.googleapis.com/CertificateAuthority" + } + ]; + + // Optional. An ID to identify requests. Specify a unique request ID so that if you must + // retry your request, the server will know to ignore the request if it has + // already been completed. The server will guarantee that for at least 60 + // minutes since the first request. + // + // For example, consider a situation where you make an initial request and t + // he request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [CertificateAuthorityService.DeleteCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.DeleteCertificateAuthority]. +message DeleteCertificateAuthorityRequest { + // Required. The resource name for this [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] in the + // format `projects/*/locations/*/caPools/*/certificateAuthorities/*`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "privateca.googleapis.com/CertificateAuthority" + } + ]; + + // Optional. An ID to identify requests. Specify a unique request ID so that if you must + // retry your request, the server will know to ignore the request if it has + // already been completed. The server will guarantee that for at least 60 + // minutes since the first request. + // + // For example, consider a situation where you make an initial request and t + // he request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. This field allows the CA to be deleted even if the CA has + // active certs. Active certs include both unrevoked and unexpired certs. + bool ignore_active_certificates = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If this flag is set, the Certificate Authority will be deleted as soon as + // possible without a 30-day grace period where undeletion would have been + // allowed. If you proceed, there will be no way to recover this CA. + bool skip_grace_period = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [CertificateAuthorityService.UpdateCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificateAuthority]. +message UpdateCertificateAuthorityRequest { + // Required. [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] with updated values. + CertificateAuthority certificate_authority = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. A list of fields to be updated in this request. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An ID to identify requests. Specify a unique request ID so that if you must + // retry your request, the server will know to ignore the request if it has + // already been completed. The server will guarantee that for at least 60 + // minutes since the first request. + // + // For example, consider a situation where you make an initial request and t + // he request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [CertificateAuthorityService.CreateCaPool][google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCaPool]. +message CreateCaPoolRequest { + // Required. The resource name of the location associated with the + // [CaPool][google.cloud.security.privateca.v1.CaPool], 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 ca_pool_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. A [CaPool][google.cloud.security.privateca.v1.CaPool] with initial field values. + CaPool ca_pool = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An ID to identify requests. Specify a unique request ID so that if you must + // retry your request, the server will know to ignore the request if it has + // already been completed. The server will guarantee that for at least 60 + // minutes since the first request. + // + // For example, consider a situation where you make an initial request and t + // he request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [CertificateAuthorityService.UpdateCaPool][google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCaPool]. +message UpdateCaPoolRequest { + // Required. [CaPool][google.cloud.security.privateca.v1.CaPool] with updated values. + CaPool ca_pool = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. A list of fields to be updated in this request. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An ID to identify requests. Specify a unique request ID so that if you must + // retry your request, the server will know to ignore the request if it has + // already been completed. The server will guarantee that for at least 60 + // minutes since the first request. + // + // For example, consider a situation where you make an initial request and t + // he request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [CertificateAuthorityService.DeleteCaPool][google.cloud.security.privateca.v1.CertificateAuthorityService.DeleteCaPool]. +message DeleteCaPoolRequest { + // Required. The resource name for this [CaPool][google.cloud.security.privateca.v1.CaPool] in the + // format `projects/*/locations/*/caPools/*`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "privateca.googleapis.com/CaPool" + } + ]; + + // Optional. An ID to identify requests. Specify a unique request ID so that if you must + // retry your request, the server will know to ignore the request if it has + // already been completed. The server will guarantee that for at least 60 + // minutes since the first request. + // + // For example, consider a situation where you make an initial request and t + // he request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [CertificateAuthorityService.FetchCaCerts][google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCaCerts]. +message FetchCaCertsRequest { + // Required. The resource name for the [CaPool][google.cloud.security.privateca.v1.CaPool] in the + // format `projects/*/locations/*/caPools/*`. + string ca_pool = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "privateca.googleapis.com/CaPool" + } + ]; + + // Optional. An ID to identify requests. Specify a unique request ID so that if you must + // retry your request, the server will know to ignore the request if it has + // already been completed. The server will guarantee that for at least 60 + // minutes since the first request. + // + // For example, consider a situation where you make an initial request and t + // he request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for +// [CertificateAuthorityService.FetchCaCerts][google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCaCerts]. +message FetchCaCertsResponse { + message CertChain { + // The certificates that form the CA chain, from leaf to root order. + repeated string certificates = 1; + } + + // The PEM encoded CA certificate chains of all + // [ACTIVE][CertificateAuthority.State.ACTIVE] [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + // resources in this [CaPool][google.cloud.security.privateca.v1.CaPool]. + repeated CertChain ca_certs = 1; +} + +// Request message for [CertificateAuthorityService.GetCaPool][google.cloud.security.privateca.v1.CertificateAuthorityService.GetCaPool]. +message GetCaPoolRequest { + // Required. The [name][google.cloud.security.privateca.v1.CaPool.name] of the [CaPool][google.cloud.security.privateca.v1.CaPool] to get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "privateca.googleapis.com/CaPool" + } + ]; +} + +// Request message for +// [CertificateAuthorityService.ListCaPools][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCaPools]. +message ListCaPoolsRequest { + // Required. The resource name of the location associated with the + // [CaPools][google.cloud.security.privateca.v1.CaPool], in the format + // `projects/*/locations/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Optional. Limit on the number of [CaPools][google.cloud.security.privateca.v1.CaPool] to + // include in the response. + // Further [CaPools][google.cloud.security.privateca.v1.CaPool] can subsequently be + // obtained by including the + // [ListCaPoolsResponse.next_page_token][google.cloud.security.privateca.v1.ListCaPoolsResponse.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. Pagination token, returned earlier via + // [ListCaPoolsResponse.next_page_token][google.cloud.security.privateca.v1.ListCaPoolsResponse.next_page_token]. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Only include resources that match the filter in the response. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specify how the results should be sorted. + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for +// [CertificateAuthorityService.ListCaPools][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCaPools]. +message ListCaPoolsResponse { + // The list of [CaPools][google.cloud.security.privateca.v1.CaPool]. + repeated CaPool ca_pools = 1; + + // A token to retrieve next page of results. Pass this value in + // [ListCertificateAuthoritiesRequest.next_page_token][] to retrieve the next + // page of results. + string next_page_token = 2; + + // A list of locations (e.g. "us-west1") that could not be reached. + repeated string unreachable = 3; +} + +// Request message for +// [CertificateAuthorityService.GetCertificateRevocationList][google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificateRevocationList]. +message GetCertificateRevocationListRequest { + // Required. The [name][google.cloud.security.privateca.v1.CertificateRevocationList.name] of the + // [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList] to get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "privateca.googleapis.com/CertificateRevocationList" + } + ]; +} + +// Request message for +// [CertificateAuthorityService.ListCertificateRevocationLists][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateRevocationLists]. +message ListCertificateRevocationListsRequest { + // Required. The resource name of the location associated with the + // [CertificateRevocationLists][google.cloud.security.privateca.v1.CertificateRevocationList], in the format + // `projects/*/locations/*/caPools/*/certificateAuthorities/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "privateca.googleapis.com/CertificateAuthority" + } + ]; + + // Optional. Limit on the number of + // [CertificateRevocationLists][google.cloud.security.privateca.v1.CertificateRevocationList] to include in the + // response. Further [CertificateRevocationLists][google.cloud.security.privateca.v1.CertificateRevocationList] + // can subsequently be obtained by including the + // [ListCertificateRevocationListsResponse.next_page_token][google.cloud.security.privateca.v1.ListCertificateRevocationListsResponse.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. Pagination token, returned earlier via + // [ListCertificateRevocationListsResponse.next_page_token][google.cloud.security.privateca.v1.ListCertificateRevocationListsResponse.next_page_token]. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Only include resources that match the filter in the response. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specify how the results should be sorted. + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for +// [CertificateAuthorityService.ListCertificateRevocationLists][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateRevocationLists]. +message ListCertificateRevocationListsResponse { + // The list of [CertificateRevocationLists][google.cloud.security.privateca.v1.CertificateRevocationList]. + repeated CertificateRevocationList certificate_revocation_lists = 1; + + // A token to retrieve next page of results. Pass this value in + // [ListCertificateRevocationListsRequest.next_page_token][] to retrieve the + // next page of results. + string next_page_token = 2; + + // A list of locations (e.g. "us-west1") that could not be reached. + repeated string unreachable = 3; +} + +// Request message for +// [CertificateAuthorityService.UpdateCertificateRevocationList][google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificateRevocationList]. +message UpdateCertificateRevocationListRequest { + // Required. [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList] with updated values. + CertificateRevocationList certificate_revocation_list = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. A list of fields to be updated in this request. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An ID to identify requests. Specify a unique request ID so that if you must + // retry your request, the server will know to ignore the request if it has + // already been completed. The server will guarantee that for at least 60 + // minutes since the first request. + // + // For example, consider a situation where you make an initial request and t + // he request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [CertificateAuthorityService.CreateCertificateTemplate][google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCertificateTemplate]. +message CreateCertificateTemplateRequest { + // Required. The resource name of the location associated with the + // [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate], 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 certificate_template_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. A [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] with initial field values. + CertificateTemplate certificate_template = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An ID to identify requests. Specify a unique request ID so that if you must + // retry your request, the server will know to ignore the request if it has + // already been completed. The server will guarantee that for at least 60 + // minutes since the first request. + // + // For example, consider a situation where you make an initial request and t + // he request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [CertificateAuthorityService.DeleteCertificateTemplate][google.cloud.security.privateca.v1.CertificateAuthorityService.DeleteCertificateTemplate]. +message DeleteCertificateTemplateRequest { + // Required. The resource name for this [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] in the format + // `projects/*/locations/*/certificateTemplates/*`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "privateca.googleapis.com/CertificateTemplate" + } + ]; + + // Optional. An ID to identify requests. Specify a unique request ID so that if you must + // retry your request, the server will know to ignore the request if it has + // already been completed. The server will guarantee that for at least 60 + // minutes since the first request. + // + // For example, consider a situation where you make an initial request and t + // he request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [CertificateAuthorityService.GetCertificateTemplate][google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificateTemplate]. +message GetCertificateTemplateRequest { + // Required. The [name][google.cloud.security.privateca.v1.CertificateTemplate.name] of the [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] to + // get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "privateca.googleapis.com/CertificateTemplate" + } + ]; +} + +// Request message for +// [CertificateAuthorityService.ListCertificateTemplates][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateTemplates]. +message ListCertificateTemplatesRequest { + // Required. The resource name of the location associated with the + // [CertificateTemplates][google.cloud.security.privateca.v1.CertificateTemplate], in the format + // `projects/*/locations/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Optional. Limit on the number of + // [CertificateTemplates][google.cloud.security.privateca.v1.CertificateTemplate] to include in the response. + // Further [CertificateTemplates][google.cloud.security.privateca.v1.CertificateTemplate] can subsequently be + // obtained by including the + // [ListCertificateTemplatesResponse.next_page_token][google.cloud.security.privateca.v1.ListCertificateTemplatesResponse.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. Pagination token, returned earlier via + // [ListCertificateTemplatesResponse.next_page_token][google.cloud.security.privateca.v1.ListCertificateTemplatesResponse.next_page_token]. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Only include resources that match the filter in the response. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specify how the results should be sorted. + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for +// [CertificateAuthorityService.ListCertificateTemplates][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateTemplates]. +message ListCertificateTemplatesResponse { + // The list of [CertificateTemplates][google.cloud.security.privateca.v1.CertificateTemplate]. + repeated CertificateTemplate certificate_templates = 1; + + // A token to retrieve next page of results. Pass this value in + // [ListCertificateTemplatesRequest.next_page_token][] to retrieve + // the next page of results. + string next_page_token = 2; + + // A list of locations (e.g. "us-west1") that could not be reached. + repeated string unreachable = 3; +} + +// Request message for +// [CertificateAuthorityService.UpdateCertificateTemplate][google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificateTemplate]. +message UpdateCertificateTemplateRequest { + // Required. [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] with updated values. + CertificateTemplate certificate_template = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. A list of fields to be updated in this request. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An ID to identify requests. Specify a unique request ID so that if you must + // retry your request, the server will know to ignore the request if it has + // already been completed. The server will guarantee that for at least 60 + // minutes since the first request. + // + // For example, consider a situation where you make an initial request and t + // he request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Represents the metadata of the long-running operation. +message OperationMetadata { + // Output only. The time the operation was created. + google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the operation finished running. + google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Server-defined resource path for the target of the operation. + string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Name of the verb executed by the operation. + string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Human-readable status of the operation, if any. + string status_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Identifies whether the user has requested cancellation + // of the operation. Operations that have successfully been cancelled + // have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, + // corresponding to `Code.CANCELLED`. + bool requested_cancellation = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. API version used to start the operation. + string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.activate_certificate_authority.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.activate_certificate_authority.js new file mode 100644 index 0000000..b422901 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.activate_certificate_authority.js @@ -0,0 +1,86 @@ +// 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, pemCaCertificate, subordinateConfig) { + // [START privateca_v1_generated_CertificateAuthorityService_ActivateCertificateAuthority_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name for this CertificateAuthority google.cloud.security.privateca.v1.CertificateAuthority in the + * format `projects/* /locations/* /caPools/* /certificateAuthorities/*`. + */ + // const name = 'abc123' + /** + * Required. The signed CA certificate issued from + * FetchCertificateAuthorityCsrResponse.pem_csr google.cloud.security.privateca.v1.FetchCertificateAuthorityCsrResponse.pem_csr. + */ + // const pemCaCertificate = 'abc123' + /** + * Required. Must include information about the issuer of 'pem_ca_certificate', and any + * further issuers until the self-signed CA. + */ + // const subordinateConfig = {} + /** + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Privateca library + const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; + + // Instantiates a client + const privatecaClient = new CertificateAuthorityServiceClient(); + + async function callActivateCertificateAuthority() { + // Construct request + const request = { + name, + pemCaCertificate, + subordinateConfig, + }; + + // Run request + const [operation] = await privatecaClient.activateCertificateAuthority(request); + const [response] = await operation.promise(); + console.log(response); + } + + callActivateCertificateAuthority(); + // [END privateca_v1_generated_CertificateAuthorityService_ActivateCertificateAuthority_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.create_ca_pool.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.create_ca_pool.js new file mode 100644 index 0000000..66013c3 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.create_ca_pool.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, caPoolId, caPool) { + // [START privateca_v1_generated_CertificateAuthorityService_CreateCaPool_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the location associated with the + * CaPool google.cloud.security.privateca.v1.CaPool, 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 caPoolId = 'abc123' + /** + * Required. A CaPool google.cloud.security.privateca.v1.CaPool with initial field values. + */ + // const caPool = {} + /** + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Privateca library + const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; + + // Instantiates a client + const privatecaClient = new CertificateAuthorityServiceClient(); + + async function callCreateCaPool() { + // Construct request + const request = { + parent, + caPoolId, + caPool, + }; + + // Run request + const [operation] = await privatecaClient.createCaPool(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateCaPool(); + // [END privateca_v1_generated_CertificateAuthorityService_CreateCaPool_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.create_certificate.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.create_certificate.js new file mode 100644 index 0000000..f99164b --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.create_certificate.js @@ -0,0 +1,105 @@ +// 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, certificate) { + // [START privateca_v1_generated_CertificateAuthorityService_CreateCertificate_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the CaPool google.cloud.security.privateca.v1.CaPool associated with the Certificate google.cloud.security.privateca.v1.Certificate, + * in the format `projects/* /locations/* /caPools/*`. + */ + // const parent = 'abc123' + /** + * Optional. It must be unique within a location and match the regular + * expression `[a-zA-Z0-9_-]{1,63}`. This field is required when using a + * CertificateAuthority google.cloud.security.privateca.v1.CertificateAuthority in the Enterprise CertificateAuthority.Tier , + * but is optional and its value is ignored otherwise. + */ + // const certificateId = 'abc123' + /** + * Required. A Certificate google.cloud.security.privateca.v1.Certificate with initial field values. + */ + // const certificate = {} + /** + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + /** + * Optional. If this is true, no Certificate google.cloud.security.privateca.v1.Certificate resource will be persisted regardless + * of the CaPool google.cloud.security.privateca.v1.CaPool's tier google.cloud.security.privateca.v1.CaPool.tier, and the returned Certificate google.cloud.security.privateca.v1.Certificate + * will not contain the pem_certificate google.cloud.security.privateca.v1.Certificate.pem_certificate field. + */ + // const validateOnly = true + /** + * Optional. The resource ID of the CertificateAuthority google.cloud.security.privateca.v1.CertificateAuthority that should issue the + * certificate. This optional field will ignore the load-balancing scheme of + * the Pool and directly issue the certificate from the CA with the specified + * ID, contained in the same CaPool google.cloud.security.privateca.v1.CaPool referenced by `parent`. Per-CA quota + * rules apply. If left empty, a CertificateAuthority google.cloud.security.privateca.v1.CertificateAuthority will be chosen from + * the CaPool google.cloud.security.privateca.v1.CaPool by the service. For example, to issue a Certificate google.cloud.security.privateca.v1.Certificate from + * a Certificate Authority with resource name + * "projects/my-project/locations/us-central1/caPools/my-pool/certificateAuthorities/my-ca", + * you can set the parent google.cloud.security.privateca.v1.CreateCertificateRequest.parent to + * "projects/my-project/locations/us-central1/caPools/my-pool" and the + * issuing_certificate_authority_id google.cloud.security.privateca.v1.CreateCertificateRequest.issuing_certificate_authority_id to "my-ca". + */ + // const issuingCertificateAuthorityId = 'abc123' + + // Imports the Privateca library + const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; + + // Instantiates a client + const privatecaClient = new CertificateAuthorityServiceClient(); + + async function callCreateCertificate() { + // Construct request + const request = { + parent, + certificate, + }; + + // Run request + const response = await privatecaClient.createCertificate(request); + console.log(response); + } + + callCreateCertificate(); + // [END privateca_v1_generated_CertificateAuthorityService_CreateCertificate_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.create_certificate_authority.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.create_certificate_authority.js new file mode 100644 index 0000000..ee51d7e --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.create_certificate_authority.js @@ -0,0 +1,86 @@ +// 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, certificateAuthorityId, certificateAuthority) { + // [START privateca_v1_generated_CertificateAuthorityService_CreateCertificateAuthority_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the CaPool google.cloud.security.privateca.v1.CaPool associated with the + * CertificateAuthorities google.cloud.security.privateca.v1.CertificateAuthority, in the format + * `projects/* /locations/* /caPools/*`. + */ + // const parent = 'abc123' + /** + * Required. It must be unique within a location and match the regular + * expression `[a-zA-Z0-9_-]{1,63}` + */ + // const certificateAuthorityId = 'abc123' + /** + * Required. A CertificateAuthority google.cloud.security.privateca.v1.CertificateAuthority with initial field values. + */ + // const certificateAuthority = {} + /** + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Privateca library + const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; + + // Instantiates a client + const privatecaClient = new CertificateAuthorityServiceClient(); + + async function callCreateCertificateAuthority() { + // Construct request + const request = { + parent, + certificateAuthorityId, + certificateAuthority, + }; + + // Run request + const [operation] = await privatecaClient.createCertificateAuthority(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateCertificateAuthority(); + // [END privateca_v1_generated_CertificateAuthorityService_CreateCertificateAuthority_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.create_certificate_template.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.create_certificate_template.js new file mode 100644 index 0000000..b719dbf --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.create_certificate_template.js @@ -0,0 +1,86 @@ +// 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, certificateTemplateId, certificateTemplate) { + // [START privateca_v1_generated_CertificateAuthorityService_CreateCertificateTemplate_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the location associated with the + * CertificateTemplate google.cloud.security.privateca.v1.CertificateTemplate, 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 certificateTemplateId = 'abc123' + /** + * Required. A CertificateTemplate google.cloud.security.privateca.v1.CertificateTemplate with initial field values. + */ + // const certificateTemplate = {} + /** + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Privateca library + const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; + + // Instantiates a client + const privatecaClient = new CertificateAuthorityServiceClient(); + + async function callCreateCertificateTemplate() { + // Construct request + const request = { + parent, + certificateTemplateId, + certificateTemplate, + }; + + // Run request + const [operation] = await privatecaClient.createCertificateTemplate(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateCertificateTemplate(); + // [END privateca_v1_generated_CertificateAuthorityService_CreateCertificateTemplate_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.delete_ca_pool.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.delete_ca_pool.js new file mode 100644 index 0000000..c106be8 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.delete_ca_pool.js @@ -0,0 +1,74 @@ +// 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 privateca_v1_generated_CertificateAuthorityService_DeleteCaPool_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name for this CaPool google.cloud.security.privateca.v1.CaPool in the + * format `projects/* /locations/* /caPools/*`. + */ + // const name = 'abc123' + /** + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Privateca library + const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; + + // Instantiates a client + const privatecaClient = new CertificateAuthorityServiceClient(); + + async function callDeleteCaPool() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await privatecaClient.deleteCaPool(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteCaPool(); + // [END privateca_v1_generated_CertificateAuthorityService_DeleteCaPool_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.delete_certificate_authority.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.delete_certificate_authority.js new file mode 100644 index 0000000..766bc26 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.delete_certificate_authority.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(name) { + // [START privateca_v1_generated_CertificateAuthorityService_DeleteCertificateAuthority_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name for this CertificateAuthority google.cloud.security.privateca.v1.CertificateAuthority in the + * format `projects/* /locations/* /caPools/* /certificateAuthorities/*`. + */ + // const name = 'abc123' + /** + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + /** + * Optional. This field allows the CA to be deleted even if the CA has + * active certs. Active certs include both unrevoked and unexpired certs. + */ + // const ignoreActiveCertificates = true + /** + * Optional. If this flag is set, the Certificate Authority will be deleted as soon as + * possible without a 30-day grace period where undeletion would have been + * allowed. If you proceed, there will be no way to recover this CA. + */ + // const skipGracePeriod = true + + // Imports the Privateca library + const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; + + // Instantiates a client + const privatecaClient = new CertificateAuthorityServiceClient(); + + async function callDeleteCertificateAuthority() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await privatecaClient.deleteCertificateAuthority(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteCertificateAuthority(); + // [END privateca_v1_generated_CertificateAuthorityService_DeleteCertificateAuthority_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.delete_certificate_template.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.delete_certificate_template.js new file mode 100644 index 0000000..ef9eb37 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.delete_certificate_template.js @@ -0,0 +1,74 @@ +// 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 privateca_v1_generated_CertificateAuthorityService_DeleteCertificateTemplate_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name for this CertificateTemplate google.cloud.security.privateca.v1.CertificateTemplate in the format + * `projects/* /locations/* /certificateTemplates/*`. + */ + // const name = 'abc123' + /** + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Privateca library + const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; + + // Instantiates a client + const privatecaClient = new CertificateAuthorityServiceClient(); + + async function callDeleteCertificateTemplate() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await privatecaClient.deleteCertificateTemplate(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteCertificateTemplate(); + // [END privateca_v1_generated_CertificateAuthorityService_DeleteCertificateTemplate_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.disable_certificate_authority.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.disable_certificate_authority.js new file mode 100644 index 0000000..ab2d1a1 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.disable_certificate_authority.js @@ -0,0 +1,74 @@ +// 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 privateca_v1_generated_CertificateAuthorityService_DisableCertificateAuthority_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name for this CertificateAuthority google.cloud.security.privateca.v1.CertificateAuthority in the + * format `projects/* /locations/* /caPools/* /certificateAuthorities/*`. + */ + // const name = 'abc123' + /** + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Privateca library + const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; + + // Instantiates a client + const privatecaClient = new CertificateAuthorityServiceClient(); + + async function callDisableCertificateAuthority() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await privatecaClient.disableCertificateAuthority(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDisableCertificateAuthority(); + // [END privateca_v1_generated_CertificateAuthorityService_DisableCertificateAuthority_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.enable_certificate_authority.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.enable_certificate_authority.js new file mode 100644 index 0000000..ea708a6 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.enable_certificate_authority.js @@ -0,0 +1,74 @@ +// 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 privateca_v1_generated_CertificateAuthorityService_EnableCertificateAuthority_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name for this CertificateAuthority google.cloud.security.privateca.v1.CertificateAuthority in the + * format `projects/* /locations/* /caPools/* /certificateAuthorities/*`. + */ + // const name = 'abc123' + /** + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Privateca library + const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; + + // Instantiates a client + const privatecaClient = new CertificateAuthorityServiceClient(); + + async function callEnableCertificateAuthority() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await privatecaClient.enableCertificateAuthority(request); + const [response] = await operation.promise(); + console.log(response); + } + + callEnableCertificateAuthority(); + // [END privateca_v1_generated_CertificateAuthorityService_EnableCertificateAuthority_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.fetch_ca_certs.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.fetch_ca_certs.js new file mode 100644 index 0000000..74ba7d6 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.fetch_ca_certs.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(caPool) { + // [START privateca_v1_generated_CertificateAuthorityService_FetchCaCerts_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name for the CaPool google.cloud.security.privateca.v1.CaPool in the + * format `projects/* /locations/* /caPools/*`. + */ + // const caPool = 'abc123' + /** + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Privateca library + const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; + + // Instantiates a client + const privatecaClient = new CertificateAuthorityServiceClient(); + + async function callFetchCaCerts() { + // Construct request + const request = { + caPool, + }; + + // Run request + const response = await privatecaClient.fetchCaCerts(request); + console.log(response); + } + + callFetchCaCerts(); + // [END privateca_v1_generated_CertificateAuthorityService_FetchCaCerts_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.fetch_certificate_authority_csr.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.fetch_certificate_authority_csr.js new file mode 100644 index 0000000..275da0d --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.fetch_certificate_authority_csr.js @@ -0,0 +1,59 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START privateca_v1_generated_CertificateAuthorityService_FetchCertificateAuthorityCsr_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name for this CertificateAuthority google.cloud.security.privateca.v1.CertificateAuthority in the + * format `projects/* /locations/* /caPools/* /certificateAuthorities/*`. + */ + // const name = 'abc123' + + // Imports the Privateca library + const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; + + // Instantiates a client + const privatecaClient = new CertificateAuthorityServiceClient(); + + async function callFetchCertificateAuthorityCsr() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await privatecaClient.fetchCertificateAuthorityCsr(request); + console.log(response); + } + + callFetchCertificateAuthorityCsr(); + // [END privateca_v1_generated_CertificateAuthorityService_FetchCertificateAuthorityCsr_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.get_ca_pool.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.get_ca_pool.js new file mode 100644 index 0000000..f189861 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.get_ca_pool.js @@ -0,0 +1,58 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START privateca_v1_generated_CertificateAuthorityService_GetCaPool_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name google.cloud.security.privateca.v1.CaPool.name of the CaPool google.cloud.security.privateca.v1.CaPool to get. + */ + // const name = 'abc123' + + // Imports the Privateca library + const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; + + // Instantiates a client + const privatecaClient = new CertificateAuthorityServiceClient(); + + async function callGetCaPool() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await privatecaClient.getCaPool(request); + console.log(response); + } + + callGetCaPool(); + // [END privateca_v1_generated_CertificateAuthorityService_GetCaPool_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.get_certificate.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.get_certificate.js new file mode 100644 index 0000000..5ba3f39 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.get_certificate.js @@ -0,0 +1,58 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START privateca_v1_generated_CertificateAuthorityService_GetCertificate_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name google.cloud.security.privateca.v1.Certificate.name of the Certificate google.cloud.security.privateca.v1.Certificate to get. + */ + // const name = 'abc123' + + // Imports the Privateca library + const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; + + // Instantiates a client + const privatecaClient = new CertificateAuthorityServiceClient(); + + async function callGetCertificate() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await privatecaClient.getCertificate(request); + console.log(response); + } + + callGetCertificate(); + // [END privateca_v1_generated_CertificateAuthorityService_GetCertificate_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.get_certificate_authority.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.get_certificate_authority.js new file mode 100644 index 0000000..5c42d6b --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.get_certificate_authority.js @@ -0,0 +1,59 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START privateca_v1_generated_CertificateAuthorityService_GetCertificateAuthority_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name google.cloud.security.privateca.v1.CertificateAuthority.name of the CertificateAuthority google.cloud.security.privateca.v1.CertificateAuthority to + * get. + */ + // const name = 'abc123' + + // Imports the Privateca library + const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; + + // Instantiates a client + const privatecaClient = new CertificateAuthorityServiceClient(); + + async function callGetCertificateAuthority() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await privatecaClient.getCertificateAuthority(request); + console.log(response); + } + + callGetCertificateAuthority(); + // [END privateca_v1_generated_CertificateAuthorityService_GetCertificateAuthority_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.get_certificate_revocation_list.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.get_certificate_revocation_list.js new file mode 100644 index 0000000..9d2ca2a --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.get_certificate_revocation_list.js @@ -0,0 +1,59 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START privateca_v1_generated_CertificateAuthorityService_GetCertificateRevocationList_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name google.cloud.security.privateca.v1.CertificateRevocationList.name of the + * CertificateRevocationList google.cloud.security.privateca.v1.CertificateRevocationList to get. + */ + // const name = 'abc123' + + // Imports the Privateca library + const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; + + // Instantiates a client + const privatecaClient = new CertificateAuthorityServiceClient(); + + async function callGetCertificateRevocationList() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await privatecaClient.getCertificateRevocationList(request); + console.log(response); + } + + callGetCertificateRevocationList(); + // [END privateca_v1_generated_CertificateAuthorityService_GetCertificateRevocationList_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.get_certificate_template.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.get_certificate_template.js new file mode 100644 index 0000000..3bbec5e --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.get_certificate_template.js @@ -0,0 +1,59 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START privateca_v1_generated_CertificateAuthorityService_GetCertificateTemplate_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name google.cloud.security.privateca.v1.CertificateTemplate.name of the CertificateTemplate google.cloud.security.privateca.v1.CertificateTemplate to + * get. + */ + // const name = 'abc123' + + // Imports the Privateca library + const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; + + // Instantiates a client + const privatecaClient = new CertificateAuthorityServiceClient(); + + async function callGetCertificateTemplate() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await privatecaClient.getCertificateTemplate(request); + console.log(response); + } + + callGetCertificateTemplate(); + // [END privateca_v1_generated_CertificateAuthorityService_GetCertificateTemplate_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.list_ca_pools.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.list_ca_pools.js new file mode 100644 index 0000000..803be8a --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.list_ca_pools.js @@ -0,0 +1,84 @@ +// 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 privateca_v1_generated_CertificateAuthorityService_ListCaPools_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the location associated with the + * CaPools google.cloud.security.privateca.v1.CaPool, in the format + * `projects/* /locations/*`. + */ + // const parent = 'abc123' + /** + * Optional. Limit on the number of CaPools google.cloud.security.privateca.v1.CaPool to + * include in the response. + * Further CaPools google.cloud.security.privateca.v1.CaPool can subsequently be + * obtained by including the + * ListCaPoolsResponse.next_page_token google.cloud.security.privateca.v1.ListCaPoolsResponse.next_page_token in a subsequent + * request. If unspecified, the server will pick an appropriate default. + */ + // const pageSize = 1234 + /** + * Optional. Pagination token, returned earlier via + * ListCaPoolsResponse.next_page_token google.cloud.security.privateca.v1.ListCaPoolsResponse.next_page_token. + */ + // const pageToken = 'abc123' + /** + * Optional. Only include resources that match the filter in the response. + */ + // const filter = 'abc123' + /** + * Optional. Specify how the results should be sorted. + */ + // const orderBy = 'abc123' + + // Imports the Privateca library + const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; + + // Instantiates a client + const privatecaClient = new CertificateAuthorityServiceClient(); + + async function callListCaPools() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await privatecaClient.listCaPoolsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListCaPools(); + // [END privateca_v1_generated_CertificateAuthorityService_ListCaPools_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.list_certificate_authorities.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.list_certificate_authorities.js new file mode 100644 index 0000000..b6ab38d --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.list_certificate_authorities.js @@ -0,0 +1,84 @@ +// 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 privateca_v1_generated_CertificateAuthorityService_ListCertificateAuthorities_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the CaPool google.cloud.security.privateca.v1.CaPool associated with the + * CertificateAuthorities google.cloud.security.privateca.v1.CertificateAuthority, in the format + * `projects/* /locations/* /caPools/*`. + */ + // const parent = 'abc123' + /** + * Optional. Limit on the number of CertificateAuthorities google.cloud.security.privateca.v1.CertificateAuthority to + * include in the response. + * Further CertificateAuthorities google.cloud.security.privateca.v1.CertificateAuthority can subsequently be + * obtained by including the + * ListCertificateAuthoritiesResponse.next_page_token google.cloud.security.privateca.v1.ListCertificateAuthoritiesResponse.next_page_token in a subsequent + * request. If unspecified, the server will pick an appropriate default. + */ + // const pageSize = 1234 + /** + * Optional. Pagination token, returned earlier via + * ListCertificateAuthoritiesResponse.next_page_token google.cloud.security.privateca.v1.ListCertificateAuthoritiesResponse.next_page_token. + */ + // const pageToken = 'abc123' + /** + * Optional. Only include resources that match the filter in the response. + */ + // const filter = 'abc123' + /** + * Optional. Specify how the results should be sorted. + */ + // const orderBy = 'abc123' + + // Imports the Privateca library + const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; + + // Instantiates a client + const privatecaClient = new CertificateAuthorityServiceClient(); + + async function callListCertificateAuthorities() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await privatecaClient.listCertificateAuthoritiesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListCertificateAuthorities(); + // [END privateca_v1_generated_CertificateAuthorityService_ListCertificateAuthorities_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.list_certificate_revocation_lists.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.list_certificate_revocation_lists.js new file mode 100644 index 0000000..92f4b33 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.list_certificate_revocation_lists.js @@ -0,0 +1,84 @@ +// 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 privateca_v1_generated_CertificateAuthorityService_ListCertificateRevocationLists_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the location associated with the + * CertificateRevocationLists google.cloud.security.privateca.v1.CertificateRevocationList, in the format + * `projects/* /locations/* /caPools/* /certificateAuthorities/*`. + */ + // const parent = 'abc123' + /** + * Optional. Limit on the number of + * CertificateRevocationLists google.cloud.security.privateca.v1.CertificateRevocationList to include in the + * response. Further CertificateRevocationLists google.cloud.security.privateca.v1.CertificateRevocationList + * can subsequently be obtained by including the + * ListCertificateRevocationListsResponse.next_page_token google.cloud.security.privateca.v1.ListCertificateRevocationListsResponse.next_page_token in a subsequent + * request. If unspecified, the server will pick an appropriate default. + */ + // const pageSize = 1234 + /** + * Optional. Pagination token, returned earlier via + * ListCertificateRevocationListsResponse.next_page_token google.cloud.security.privateca.v1.ListCertificateRevocationListsResponse.next_page_token. + */ + // const pageToken = 'abc123' + /** + * Optional. Only include resources that match the filter in the response. + */ + // const filter = 'abc123' + /** + * Optional. Specify how the results should be sorted. + */ + // const orderBy = 'abc123' + + // Imports the Privateca library + const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; + + // Instantiates a client + const privatecaClient = new CertificateAuthorityServiceClient(); + + async function callListCertificateRevocationLists() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await privatecaClient.listCertificateRevocationListsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListCertificateRevocationLists(); + // [END privateca_v1_generated_CertificateAuthorityService_ListCertificateRevocationLists_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.list_certificate_templates.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.list_certificate_templates.js new file mode 100644 index 0000000..61c4b29 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.list_certificate_templates.js @@ -0,0 +1,84 @@ +// 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 privateca_v1_generated_CertificateAuthorityService_ListCertificateTemplates_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the location associated with the + * CertificateTemplates google.cloud.security.privateca.v1.CertificateTemplate, in the format + * `projects/* /locations/*`. + */ + // const parent = 'abc123' + /** + * Optional. Limit on the number of + * CertificateTemplates google.cloud.security.privateca.v1.CertificateTemplate to include in the response. + * Further CertificateTemplates google.cloud.security.privateca.v1.CertificateTemplate can subsequently be + * obtained by including the + * ListCertificateTemplatesResponse.next_page_token google.cloud.security.privateca.v1.ListCertificateTemplatesResponse.next_page_token in a subsequent + * request. If unspecified, the server will pick an appropriate default. + */ + // const pageSize = 1234 + /** + * Optional. Pagination token, returned earlier via + * ListCertificateTemplatesResponse.next_page_token google.cloud.security.privateca.v1.ListCertificateTemplatesResponse.next_page_token. + */ + // const pageToken = 'abc123' + /** + * Optional. Only include resources that match the filter in the response. + */ + // const filter = 'abc123' + /** + * Optional. Specify how the results should be sorted. + */ + // const orderBy = 'abc123' + + // Imports the Privateca library + const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; + + // Instantiates a client + const privatecaClient = new CertificateAuthorityServiceClient(); + + async function callListCertificateTemplates() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await privatecaClient.listCertificateTemplatesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListCertificateTemplates(); + // [END privateca_v1_generated_CertificateAuthorityService_ListCertificateTemplates_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.list_certificates.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.list_certificates.js new file mode 100644 index 0000000..8d4b152 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.list_certificates.js @@ -0,0 +1,88 @@ +// 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 privateca_v1_generated_CertificateAuthorityService_ListCertificates_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the location associated with the + * Certificates google.cloud.security.privateca.v1.Certificate, in the format + * `projects/* /locations/* /caPools/*`. + */ + // const parent = 'abc123' + /** + * Optional. Limit on the number of + * Certificates google.cloud.security.privateca.v1.Certificate to include in the + * response. Further Certificates google.cloud.security.privateca.v1.Certificate can subsequently be obtained + * by including the + * ListCertificatesResponse.next_page_token google.cloud.security.privateca.v1.ListCertificatesResponse.next_page_token in a subsequent + * request. If unspecified, the server will pick an appropriate default. + */ + // const pageSize = 1234 + /** + * Optional. Pagination token, returned earlier via + * ListCertificatesResponse.next_page_token google.cloud.security.privateca.v1.ListCertificatesResponse.next_page_token. + */ + // const pageToken = 'abc123' + /** + * Optional. Only include resources that match the filter in the response. For details + * on supported filters and syntax, see Certificates Filtering + * documentation (https://cloud.google.com/certificate-authority-service/docs/sorting-filtering-certificates#filtering_support). + */ + // const filter = 'abc123' + /** + * Optional. Specify how the results should be sorted. For details on supported fields + * and syntax, see Certificates Sorting + * documentation (https://cloud.google.com/certificate-authority-service/docs/sorting-filtering-certificates#sorting_support). + */ + // const orderBy = 'abc123' + + // Imports the Privateca library + const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; + + // Instantiates a client + const privatecaClient = new CertificateAuthorityServiceClient(); + + async function callListCertificates() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await privatecaClient.listCertificatesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListCertificates(); + // [END privateca_v1_generated_CertificateAuthorityService_ListCertificates_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.revoke_certificate.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.revoke_certificate.js new file mode 100644 index 0000000..a4776a7 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.revoke_certificate.js @@ -0,0 +1,79 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name, reason) { + // [START privateca_v1_generated_CertificateAuthorityService_RevokeCertificate_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name for this Certificate google.cloud.security.privateca.v1.Certificate in the + * format + * `projects/* /locations/* /caPools/* /certificates/*`. + */ + // const name = 'abc123' + /** + * Required. The RevocationReason google.cloud.security.privateca.v1.RevocationReason for revoking this certificate. + */ + // const reason = {} + /** + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Privateca library + const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; + + // Instantiates a client + const privatecaClient = new CertificateAuthorityServiceClient(); + + async function callRevokeCertificate() { + // Construct request + const request = { + name, + reason, + }; + + // Run request + const response = await privatecaClient.revokeCertificate(request); + console.log(response); + } + + callRevokeCertificate(); + // [END privateca_v1_generated_CertificateAuthorityService_RevokeCertificate_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.undelete_certificate_authority.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.undelete_certificate_authority.js new file mode 100644 index 0000000..72949fc --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.undelete_certificate_authority.js @@ -0,0 +1,74 @@ +// 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 privateca_v1_generated_CertificateAuthorityService_UndeleteCertificateAuthority_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name for this CertificateAuthority google.cloud.security.privateca.v1.CertificateAuthority in the + * format `projects/* /locations/* /caPools/* /certificateAuthorities/*`. + */ + // const name = 'abc123' + /** + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Privateca library + const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; + + // Instantiates a client + const privatecaClient = new CertificateAuthorityServiceClient(); + + async function callUndeleteCertificateAuthority() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await privatecaClient.undeleteCertificateAuthority(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUndeleteCertificateAuthority(); + // [END privateca_v1_generated_CertificateAuthorityService_UndeleteCertificateAuthority_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.update_ca_pool.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.update_ca_pool.js new file mode 100644 index 0000000..13c067c --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.update_ca_pool.js @@ -0,0 +1,78 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(caPool, updateMask) { + // [START privateca_v1_generated_CertificateAuthorityService_UpdateCaPool_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. CaPool google.cloud.security.privateca.v1.CaPool with updated values. + */ + // const caPool = {} + /** + * Required. A list of fields to be updated in this request. + */ + // const updateMask = {} + /** + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Privateca library + const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; + + // Instantiates a client + const privatecaClient = new CertificateAuthorityServiceClient(); + + async function callUpdateCaPool() { + // Construct request + const request = { + caPool, + updateMask, + }; + + // Run request + const [operation] = await privatecaClient.updateCaPool(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateCaPool(); + // [END privateca_v1_generated_CertificateAuthorityService_UpdateCaPool_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.update_certificate.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.update_certificate.js new file mode 100644 index 0000000..590b914 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.update_certificate.js @@ -0,0 +1,77 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(certificate, updateMask) { + // [START privateca_v1_generated_CertificateAuthorityService_UpdateCertificate_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Certificate google.cloud.security.privateca.v1.Certificate with updated values. + */ + // const certificate = {} + /** + * Required. A list of fields to be updated in this request. + */ + // const updateMask = {} + /** + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Privateca library + const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; + + // Instantiates a client + const privatecaClient = new CertificateAuthorityServiceClient(); + + async function callUpdateCertificate() { + // Construct request + const request = { + certificate, + updateMask, + }; + + // Run request + const response = await privatecaClient.updateCertificate(request); + console.log(response); + } + + callUpdateCertificate(); + // [END privateca_v1_generated_CertificateAuthorityService_UpdateCertificate_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.update_certificate_authority.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.update_certificate_authority.js new file mode 100644 index 0000000..850c80c --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.update_certificate_authority.js @@ -0,0 +1,78 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(certificateAuthority, updateMask) { + // [START privateca_v1_generated_CertificateAuthorityService_UpdateCertificateAuthority_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. CertificateAuthority google.cloud.security.privateca.v1.CertificateAuthority with updated values. + */ + // const certificateAuthority = {} + /** + * Required. A list of fields to be updated in this request. + */ + // const updateMask = {} + /** + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Privateca library + const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; + + // Instantiates a client + const privatecaClient = new CertificateAuthorityServiceClient(); + + async function callUpdateCertificateAuthority() { + // Construct request + const request = { + certificateAuthority, + updateMask, + }; + + // Run request + const [operation] = await privatecaClient.updateCertificateAuthority(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateCertificateAuthority(); + // [END privateca_v1_generated_CertificateAuthorityService_UpdateCertificateAuthority_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.update_certificate_revocation_list.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.update_certificate_revocation_list.js new file mode 100644 index 0000000..8c71f90 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.update_certificate_revocation_list.js @@ -0,0 +1,78 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(certificateRevocationList, updateMask) { + // [START privateca_v1_generated_CertificateAuthorityService_UpdateCertificateRevocationList_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. CertificateRevocationList google.cloud.security.privateca.v1.CertificateRevocationList with updated values. + */ + // const certificateRevocationList = {} + /** + * Required. A list of fields to be updated in this request. + */ + // const updateMask = {} + /** + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Privateca library + const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; + + // Instantiates a client + const privatecaClient = new CertificateAuthorityServiceClient(); + + async function callUpdateCertificateRevocationList() { + // Construct request + const request = { + certificateRevocationList, + updateMask, + }; + + // Run request + const [operation] = await privatecaClient.updateCertificateRevocationList(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateCertificateRevocationList(); + // [END privateca_v1_generated_CertificateAuthorityService_UpdateCertificateRevocationList_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.update_certificate_template.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.update_certificate_template.js new file mode 100644 index 0000000..727a169 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.update_certificate_template.js @@ -0,0 +1,78 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(certificateTemplate, updateMask) { + // [START privateca_v1_generated_CertificateAuthorityService_UpdateCertificateTemplate_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. CertificateTemplate google.cloud.security.privateca.v1.CertificateTemplate with updated values. + */ + // const certificateTemplate = {} + /** + * Required. A list of fields to be updated in this request. + */ + // const updateMask = {} + /** + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Privateca library + const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; + + // Instantiates a client + const privatecaClient = new CertificateAuthorityServiceClient(); + + async function callUpdateCertificateTemplate() { + // Construct request + const request = { + certificateTemplate, + updateMask, + }; + + // Run request + const [operation] = await privatecaClient.updateCertificateTemplate(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateCertificateTemplate(); + // [END privateca_v1_generated_CertificateAuthorityService_UpdateCertificateTemplate_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.security.privateca.v1.json b/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.security.privateca.v1.json new file mode 100644 index 0000000..b27fdf4 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.security.privateca.v1.json @@ -0,0 +1,1407 @@ +{ + "clientLibrary": { + "name": "nodejs-privateca", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.security.privateca.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "privateca_v1_generated_CertificateAuthorityService_CreateCertificate_async", + "title": "CertificateAuthorityService createCertificate Sample", + "origin": "API_DEFINITION", + "description": " Create a new [Certificate][google.cloud.security.privateca.v1.Certificate] in a given Project, Location from a particular [CaPool][google.cloud.security.privateca.v1.CaPool].", + "canonical": true, + "file": "certificate_authority_service.create_certificate.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 97, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateCertificate", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCertificate", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "certificate_id", + "type": "TYPE_STRING" + }, + { + "name": "certificate", + "type": ".google.cloud.security.privateca.v1.Certificate" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + }, + { + "name": "issuing_certificate_authority_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.security.privateca.v1.Certificate", + "client": { + "shortName": "CertificateAuthorityServiceClient", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" + }, + "method": { + "shortName": "CreateCertificate", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCertificate", + "service": { + "shortName": "CertificateAuthorityService", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" + } + } + } + }, + { + "regionTag": "privateca_v1_generated_CertificateAuthorityService_GetCertificate_async", + "title": "CertificateAuthorityService getCertificate Sample", + "origin": "API_DEFINITION", + "description": " Returns a [Certificate][google.cloud.security.privateca.v1.Certificate].", + "canonical": true, + "file": "certificate_authority_service.get_certificate.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 50, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetCertificate", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificate", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.security.privateca.v1.Certificate", + "client": { + "shortName": "CertificateAuthorityServiceClient", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" + }, + "method": { + "shortName": "GetCertificate", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificate", + "service": { + "shortName": "CertificateAuthorityService", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" + } + } + } + }, + { + "regionTag": "privateca_v1_generated_CertificateAuthorityService_ListCertificates_async", + "title": "CertificateAuthorityService listCertificates Sample", + "origin": "API_DEFINITION", + "description": " Lists [Certificates][google.cloud.security.privateca.v1.Certificate].", + "canonical": true, + "file": "certificate_authority_service.list_certificates.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 80, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListCertificates", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificates", + "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.security.privateca.v1.ListCertificatesResponse", + "client": { + "shortName": "CertificateAuthorityServiceClient", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" + }, + "method": { + "shortName": "ListCertificates", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificates", + "service": { + "shortName": "CertificateAuthorityService", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" + } + } + } + }, + { + "regionTag": "privateca_v1_generated_CertificateAuthorityService_RevokeCertificate_async", + "title": "CertificateAuthorityService revokeCertificate Sample", + "origin": "API_DEFINITION", + "description": " Revoke a [Certificate][google.cloud.security.privateca.v1.Certificate].", + "canonical": true, + "file": "certificate_authority_service.revoke_certificate.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RevokeCertificate", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.RevokeCertificate", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "reason", + "type": ".google.cloud.security.privateca.v1.RevocationReason" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.security.privateca.v1.Certificate", + "client": { + "shortName": "CertificateAuthorityServiceClient", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" + }, + "method": { + "shortName": "RevokeCertificate", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.RevokeCertificate", + "service": { + "shortName": "CertificateAuthorityService", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" + } + } + } + }, + { + "regionTag": "privateca_v1_generated_CertificateAuthorityService_UpdateCertificate_async", + "title": "CertificateAuthorityService updateCertificate Sample", + "origin": "API_DEFINITION", + "description": " Update a [Certificate][google.cloud.security.privateca.v1.Certificate]. Currently, the only field you can update is the [labels][google.cloud.security.privateca.v1.Certificate.labels] field.", + "canonical": true, + "file": "certificate_authority_service.update_certificate.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateCertificate", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificate", + "async": true, + "parameters": [ + { + "name": "certificate", + "type": ".google.cloud.security.privateca.v1.Certificate" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.security.privateca.v1.Certificate", + "client": { + "shortName": "CertificateAuthorityServiceClient", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" + }, + "method": { + "shortName": "UpdateCertificate", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificate", + "service": { + "shortName": "CertificateAuthorityService", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" + } + } + } + }, + { + "regionTag": "privateca_v1_generated_CertificateAuthorityService_ActivateCertificateAuthority_async", + "title": "CertificateAuthorityService activateCertificateAuthority Sample", + "origin": "API_DEFINITION", + "description": " Activate a [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] that is in state [AWAITING_USER_ACTIVATION][google.cloud.security.privateca.v1.CertificateAuthority.State.AWAITING_USER_ACTIVATION] and is of type [SUBORDINATE][google.cloud.security.privateca.v1.CertificateAuthority.Type.SUBORDINATE]. After the parent Certificate Authority signs a certificate signing request from [FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCertificateAuthorityCsr], this method can complete the activation process.", + "canonical": true, + "file": "certificate_authority_service.activate_certificate_authority.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ActivateCertificateAuthority", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.ActivateCertificateAuthority", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "pem_ca_certificate", + "type": "TYPE_STRING" + }, + { + "name": "subordinate_config", + "type": ".google.cloud.security.privateca.v1.SubordinateConfig" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CertificateAuthorityServiceClient", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" + }, + "method": { + "shortName": "ActivateCertificateAuthority", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.ActivateCertificateAuthority", + "service": { + "shortName": "CertificateAuthorityService", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" + } + } + } + }, + { + "regionTag": "privateca_v1_generated_CertificateAuthorityService_CreateCertificateAuthority_async", + "title": "CertificateAuthorityService createCertificateAuthority Sample", + "origin": "API_DEFINITION", + "description": " Create a new [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] in a given Project and Location.", + "canonical": true, + "file": "certificate_authority_service.create_certificate_authority.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateCertificateAuthority", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCertificateAuthority", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "certificate_authority_id", + "type": "TYPE_STRING" + }, + { + "name": "certificate_authority", + "type": ".google.cloud.security.privateca.v1.CertificateAuthority" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CertificateAuthorityServiceClient", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" + }, + "method": { + "shortName": "CreateCertificateAuthority", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCertificateAuthority", + "service": { + "shortName": "CertificateAuthorityService", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" + } + } + } + }, + { + "regionTag": "privateca_v1_generated_CertificateAuthorityService_DisableCertificateAuthority_async", + "title": "CertificateAuthorityService disableCertificateAuthority Sample", + "origin": "API_DEFINITION", + "description": " Disable a [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority].", + "canonical": true, + "file": "certificate_authority_service.disable_certificate_authority.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DisableCertificateAuthority", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.DisableCertificateAuthority", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CertificateAuthorityServiceClient", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" + }, + "method": { + "shortName": "DisableCertificateAuthority", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.DisableCertificateAuthority", + "service": { + "shortName": "CertificateAuthorityService", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" + } + } + } + }, + { + "regionTag": "privateca_v1_generated_CertificateAuthorityService_EnableCertificateAuthority_async", + "title": "CertificateAuthorityService enableCertificateAuthority Sample", + "origin": "API_DEFINITION", + "description": " Enable a [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority].", + "canonical": true, + "file": "certificate_authority_service.enable_certificate_authority.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "EnableCertificateAuthority", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.EnableCertificateAuthority", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CertificateAuthorityServiceClient", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" + }, + "method": { + "shortName": "EnableCertificateAuthority", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.EnableCertificateAuthority", + "service": { + "shortName": "CertificateAuthorityService", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" + } + } + } + }, + { + "regionTag": "privateca_v1_generated_CertificateAuthorityService_FetchCertificateAuthorityCsr_async", + "title": "CertificateAuthorityService fetchCertificateAuthorityCsr Sample", + "origin": "API_DEFINITION", + "description": " Fetch a certificate signing request (CSR) from a [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] that is in state [AWAITING_USER_ACTIVATION][google.cloud.security.privateca.v1.CertificateAuthority.State.AWAITING_USER_ACTIVATION] and is of type [SUBORDINATE][google.cloud.security.privateca.v1.CertificateAuthority.Type.SUBORDINATE]. The CSR must then be signed by the desired parent Certificate Authority, which could be another [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] resource, or could be an on-prem certificate authority. See also [ActivateCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.ActivateCertificateAuthority].", + "canonical": true, + "file": "certificate_authority_service.fetch_certificate_authority_csr.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "FetchCertificateAuthorityCsr", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCertificateAuthorityCsr", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.security.privateca.v1.FetchCertificateAuthorityCsrResponse", + "client": { + "shortName": "CertificateAuthorityServiceClient", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" + }, + "method": { + "shortName": "FetchCertificateAuthorityCsr", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCertificateAuthorityCsr", + "service": { + "shortName": "CertificateAuthorityService", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" + } + } + } + }, + { + "regionTag": "privateca_v1_generated_CertificateAuthorityService_GetCertificateAuthority_async", + "title": "CertificateAuthorityService getCertificateAuthority Sample", + "origin": "API_DEFINITION", + "description": " Returns a [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority].", + "canonical": true, + "file": "certificate_authority_service.get_certificate_authority.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetCertificateAuthority", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificateAuthority", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.security.privateca.v1.CertificateAuthority", + "client": { + "shortName": "CertificateAuthorityServiceClient", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" + }, + "method": { + "shortName": "GetCertificateAuthority", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificateAuthority", + "service": { + "shortName": "CertificateAuthorityService", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" + } + } + } + }, + { + "regionTag": "privateca_v1_generated_CertificateAuthorityService_ListCertificateAuthorities_async", + "title": "CertificateAuthorityService listCertificateAuthorities Sample", + "origin": "API_DEFINITION", + "description": " Lists [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority].", + "canonical": true, + "file": "certificate_authority_service.list_certificate_authorities.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 76, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListCertificateAuthorities", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateAuthorities", + "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.security.privateca.v1.ListCertificateAuthoritiesResponse", + "client": { + "shortName": "CertificateAuthorityServiceClient", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" + }, + "method": { + "shortName": "ListCertificateAuthorities", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateAuthorities", + "service": { + "shortName": "CertificateAuthorityService", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" + } + } + } + }, + { + "regionTag": "privateca_v1_generated_CertificateAuthorityService_UndeleteCertificateAuthority_async", + "title": "CertificateAuthorityService undeleteCertificateAuthority Sample", + "origin": "API_DEFINITION", + "description": " Undelete a [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] that has been deleted.", + "canonical": true, + "file": "certificate_authority_service.undelete_certificate_authority.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UndeleteCertificateAuthority", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.UndeleteCertificateAuthority", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CertificateAuthorityServiceClient", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" + }, + "method": { + "shortName": "UndeleteCertificateAuthority", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.UndeleteCertificateAuthority", + "service": { + "shortName": "CertificateAuthorityService", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" + } + } + } + }, + { + "regionTag": "privateca_v1_generated_CertificateAuthorityService_DeleteCertificateAuthority_async", + "title": "CertificateAuthorityService deleteCertificateAuthority Sample", + "origin": "API_DEFINITION", + "description": " Delete a [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority].", + "canonical": true, + "file": "certificate_authority_service.delete_certificate_authority.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 77, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteCertificateAuthority", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.DeleteCertificateAuthority", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + }, + { + "name": "ignore_active_certificates", + "type": "TYPE_BOOL" + }, + { + "name": "skip_grace_period", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CertificateAuthorityServiceClient", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" + }, + "method": { + "shortName": "DeleteCertificateAuthority", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.DeleteCertificateAuthority", + "service": { + "shortName": "CertificateAuthorityService", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" + } + } + } + }, + { + "regionTag": "privateca_v1_generated_CertificateAuthorityService_UpdateCertificateAuthority_async", + "title": "CertificateAuthorityService updateCertificateAuthority Sample", + "origin": "API_DEFINITION", + "description": " Update a [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority].", + "canonical": true, + "file": "certificate_authority_service.update_certificate_authority.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 70, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateCertificateAuthority", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificateAuthority", + "async": true, + "parameters": [ + { + "name": "certificate_authority", + "type": ".google.cloud.security.privateca.v1.CertificateAuthority" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CertificateAuthorityServiceClient", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" + }, + "method": { + "shortName": "UpdateCertificateAuthority", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificateAuthority", + "service": { + "shortName": "CertificateAuthorityService", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" + } + } + } + }, + { + "regionTag": "privateca_v1_generated_CertificateAuthorityService_CreateCaPool_async", + "title": "CertificateAuthorityService createCaPool Sample", + "origin": "API_DEFINITION", + "description": " Create a [CaPool][google.cloud.security.privateca.v1.CaPool].", + "canonical": true, + "file": "certificate_authority_service.create_ca_pool.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 77, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateCaPool", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCaPool", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "ca_pool_id", + "type": "TYPE_STRING" + }, + { + "name": "ca_pool", + "type": ".google.cloud.security.privateca.v1.CaPool" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CertificateAuthorityServiceClient", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" + }, + "method": { + "shortName": "CreateCaPool", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCaPool", + "service": { + "shortName": "CertificateAuthorityService", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" + } + } + } + }, + { + "regionTag": "privateca_v1_generated_CertificateAuthorityService_UpdateCaPool_async", + "title": "CertificateAuthorityService updateCaPool Sample", + "origin": "API_DEFINITION", + "description": " Update a [CaPool][google.cloud.security.privateca.v1.CaPool].", + "canonical": true, + "file": "certificate_authority_service.update_ca_pool.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 70, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateCaPool", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCaPool", + "async": true, + "parameters": [ + { + "name": "ca_pool", + "type": ".google.cloud.security.privateca.v1.CaPool" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CertificateAuthorityServiceClient", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" + }, + "method": { + "shortName": "UpdateCaPool", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCaPool", + "service": { + "shortName": "CertificateAuthorityService", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" + } + } + } + }, + { + "regionTag": "privateca_v1_generated_CertificateAuthorityService_GetCaPool_async", + "title": "CertificateAuthorityService getCaPool Sample", + "origin": "API_DEFINITION", + "description": " Returns a [CaPool][google.cloud.security.privateca.v1.CaPool].", + "canonical": true, + "file": "certificate_authority_service.get_ca_pool.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 50, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetCaPool", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.GetCaPool", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.security.privateca.v1.CaPool", + "client": { + "shortName": "CertificateAuthorityServiceClient", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" + }, + "method": { + "shortName": "GetCaPool", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.GetCaPool", + "service": { + "shortName": "CertificateAuthorityService", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" + } + } + } + }, + { + "regionTag": "privateca_v1_generated_CertificateAuthorityService_ListCaPools_async", + "title": "CertificateAuthorityService listCaPools Sample", + "origin": "API_DEFINITION", + "description": " Lists [CaPools][google.cloud.security.privateca.v1.CaPool].", + "canonical": true, + "file": "certificate_authority_service.list_ca_pools.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 76, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListCaPools", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.ListCaPools", + "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.security.privateca.v1.ListCaPoolsResponse", + "client": { + "shortName": "CertificateAuthorityServiceClient", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" + }, + "method": { + "shortName": "ListCaPools", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.ListCaPools", + "service": { + "shortName": "CertificateAuthorityService", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" + } + } + } + }, + { + "regionTag": "privateca_v1_generated_CertificateAuthorityService_DeleteCaPool_async", + "title": "CertificateAuthorityService deleteCaPool Sample", + "origin": "API_DEFINITION", + "description": " Delete a [CaPool][google.cloud.security.privateca.v1.CaPool].", + "canonical": true, + "file": "certificate_authority_service.delete_ca_pool.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteCaPool", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.DeleteCaPool", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CertificateAuthorityServiceClient", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" + }, + "method": { + "shortName": "DeleteCaPool", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.DeleteCaPool", + "service": { + "shortName": "CertificateAuthorityService", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" + } + } + } + }, + { + "regionTag": "privateca_v1_generated_CertificateAuthorityService_FetchCaCerts_async", + "title": "CertificateAuthorityService fetchCaCerts Sample", + "origin": "API_DEFINITION", + "description": " FetchCaCerts returns the current trust anchor for the [CaPool][google.cloud.security.privateca.v1.CaPool]. This will include CA certificate chains for all ACTIVE [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] resources in the [CaPool][google.cloud.security.privateca.v1.CaPool].", + "canonical": true, + "file": "certificate_authority_service.fetch_ca_certs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "FetchCaCerts", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCaCerts", + "async": true, + "parameters": [ + { + "name": "ca_pool", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.security.privateca.v1.FetchCaCertsResponse", + "client": { + "shortName": "CertificateAuthorityServiceClient", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" + }, + "method": { + "shortName": "FetchCaCerts", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCaCerts", + "service": { + "shortName": "CertificateAuthorityService", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" + } + } + } + }, + { + "regionTag": "privateca_v1_generated_CertificateAuthorityService_GetCertificateRevocationList_async", + "title": "CertificateAuthorityService getCertificateRevocationList Sample", + "origin": "API_DEFINITION", + "description": " Returns a [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList].", + "canonical": true, + "file": "certificate_authority_service.get_certificate_revocation_list.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetCertificateRevocationList", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificateRevocationList", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.security.privateca.v1.CertificateRevocationList", + "client": { + "shortName": "CertificateAuthorityServiceClient", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" + }, + "method": { + "shortName": "GetCertificateRevocationList", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificateRevocationList", + "service": { + "shortName": "CertificateAuthorityService", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" + } + } + } + }, + { + "regionTag": "privateca_v1_generated_CertificateAuthorityService_ListCertificateRevocationLists_async", + "title": "CertificateAuthorityService listCertificateRevocationLists Sample", + "origin": "API_DEFINITION", + "description": " Lists [CertificateRevocationLists][google.cloud.security.privateca.v1.CertificateRevocationList].", + "canonical": true, + "file": "certificate_authority_service.list_certificate_revocation_lists.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 76, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListCertificateRevocationLists", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateRevocationLists", + "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.security.privateca.v1.ListCertificateRevocationListsResponse", + "client": { + "shortName": "CertificateAuthorityServiceClient", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" + }, + "method": { + "shortName": "ListCertificateRevocationLists", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateRevocationLists", + "service": { + "shortName": "CertificateAuthorityService", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" + } + } + } + }, + { + "regionTag": "privateca_v1_generated_CertificateAuthorityService_UpdateCertificateRevocationList_async", + "title": "CertificateAuthorityService updateCertificateRevocationList Sample", + "origin": "API_DEFINITION", + "description": " Update a [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList].", + "canonical": true, + "file": "certificate_authority_service.update_certificate_revocation_list.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 70, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateCertificateRevocationList", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificateRevocationList", + "async": true, + "parameters": [ + { + "name": "certificate_revocation_list", + "type": ".google.cloud.security.privateca.v1.CertificateRevocationList" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CertificateAuthorityServiceClient", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" + }, + "method": { + "shortName": "UpdateCertificateRevocationList", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificateRevocationList", + "service": { + "shortName": "CertificateAuthorityService", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" + } + } + } + }, + { + "regionTag": "privateca_v1_generated_CertificateAuthorityService_CreateCertificateTemplate_async", + "title": "CertificateAuthorityService createCertificateTemplate Sample", + "origin": "API_DEFINITION", + "description": " Create a new [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] in a given Project and Location.", + "canonical": true, + "file": "certificate_authority_service.create_certificate_template.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateCertificateTemplate", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCertificateTemplate", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "certificate_template_id", + "type": "TYPE_STRING" + }, + { + "name": "certificate_template", + "type": ".google.cloud.security.privateca.v1.CertificateTemplate" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CertificateAuthorityServiceClient", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" + }, + "method": { + "shortName": "CreateCertificateTemplate", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCertificateTemplate", + "service": { + "shortName": "CertificateAuthorityService", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" + } + } + } + }, + { + "regionTag": "privateca_v1_generated_CertificateAuthorityService_DeleteCertificateTemplate_async", + "title": "CertificateAuthorityService deleteCertificateTemplate Sample", + "origin": "API_DEFINITION", + "description": " DeleteCertificateTemplate deletes a [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate].", + "canonical": true, + "file": "certificate_authority_service.delete_certificate_template.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteCertificateTemplate", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.DeleteCertificateTemplate", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CertificateAuthorityServiceClient", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" + }, + "method": { + "shortName": "DeleteCertificateTemplate", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.DeleteCertificateTemplate", + "service": { + "shortName": "CertificateAuthorityService", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" + } + } + } + }, + { + "regionTag": "privateca_v1_generated_CertificateAuthorityService_GetCertificateTemplate_async", + "title": "CertificateAuthorityService getCertificateTemplate Sample", + "origin": "API_DEFINITION", + "description": " Returns a [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate].", + "canonical": true, + "file": "certificate_authority_service.get_certificate_template.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetCertificateTemplate", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificateTemplate", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.security.privateca.v1.CertificateTemplate", + "client": { + "shortName": "CertificateAuthorityServiceClient", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" + }, + "method": { + "shortName": "GetCertificateTemplate", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificateTemplate", + "service": { + "shortName": "CertificateAuthorityService", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" + } + } + } + }, + { + "regionTag": "privateca_v1_generated_CertificateAuthorityService_ListCertificateTemplates_async", + "title": "CertificateAuthorityService listCertificateTemplates Sample", + "origin": "API_DEFINITION", + "description": " Lists [CertificateTemplates][google.cloud.security.privateca.v1.CertificateTemplate].", + "canonical": true, + "file": "certificate_authority_service.list_certificate_templates.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 76, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListCertificateTemplates", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateTemplates", + "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.security.privateca.v1.ListCertificateTemplatesResponse", + "client": { + "shortName": "CertificateAuthorityServiceClient", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" + }, + "method": { + "shortName": "ListCertificateTemplates", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateTemplates", + "service": { + "shortName": "CertificateAuthorityService", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" + } + } + } + }, + { + "regionTag": "privateca_v1_generated_CertificateAuthorityService_UpdateCertificateTemplate_async", + "title": "CertificateAuthorityService updateCertificateTemplate Sample", + "origin": "API_DEFINITION", + "description": " Update a [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate].", + "canonical": true, + "file": "certificate_authority_service.update_certificate_template.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 70, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateCertificateTemplate", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificateTemplate", + "async": true, + "parameters": [ + { + "name": "certificate_template", + "type": ".google.cloud.security.privateca.v1.CertificateTemplate" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CertificateAuthorityServiceClient", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" + }, + "method": { + "shortName": "UpdateCertificateTemplate", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificateTemplate", + "service": { + "shortName": "CertificateAuthorityService", + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" + } + } + } + } + ] +} diff --git a/owl-bot-staging/v1/src/index.ts b/owl-bot-staging/v1/src/index.ts new file mode 100644 index 0000000..eeb96bd --- /dev/null +++ b/owl-bot-staging/v1/src/index.ts @@ -0,0 +1,25 @@ +// 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 v1 from './v1'; +const CertificateAuthorityServiceClient = v1.CertificateAuthorityServiceClient; +type CertificateAuthorityServiceClient = v1.CertificateAuthorityServiceClient; +export {v1, CertificateAuthorityServiceClient}; +export default {v1, CertificateAuthorityServiceClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/v1/src/v1/certificate_authority_service_client.ts b/owl-bot-staging/v1/src/v1/certificate_authority_service_client.ts new file mode 100644 index 0000000..7e6ba33 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/certificate_authority_service_client.ts @@ -0,0 +1,4427 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1/certificate_authority_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './certificate_authority_service_client_config.json'; +import { operationsProtos } from 'google-gax'; +const version = require('../../../package.json').version; + +/** + * {@link google.cloud.security.privateca.v1.CertificateAuthorityService|Certificate Authority Service} manages private + * certificate authorities and issued certificates. + * @class + * @memberof v1 + */ +export class CertificateAuthorityServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + iamClient: IamClient; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + certificateAuthorityServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of CertificateAuthorityServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof CertificateAuthorityServiceClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.iamClient = new IamClient(this._gaxGrpc, opts); + + this.locationsClient = new LocationsClient(this._gaxGrpc, opts); + + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + caPoolPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/caPools/{ca_pool}' + ), + certificatePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/caPools/{ca_pool}/certificates/{certificate}' + ), + certificateAuthorityPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/caPools/{ca_pool}/certificateAuthorities/{certificate_authority}' + ), + certificateRevocationListPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/caPools/{ca_pool}/certificateAuthorities/{certificate_authority}/certificateRevocationLists/{certificate_revocation_list}' + ), + certificateTemplatePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/certificateTemplates/{certificate_template}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listCertificates: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'certificates'), + listCertificateAuthorities: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'certificateAuthorities'), + listCaPools: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'caPools'), + listCertificateRevocationLists: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'certificateRevocationLists'), + listCertificateTemplates: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'certificateTemplates') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1/{resource=projects/*/locations/*/caPools/*}:getIamPolicy',additional_bindings: [{get: '/v1/{resource=projects/*/locations/*/certificateTemplates/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/caPools/*/certificateAuthorities/*/certificateRevocationLists/*}:getIamPolicy',}], + },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/locations/*/caPools/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/certificateTemplates/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/caPools/*/certificateAuthorities/*/certificateRevocationLists/*}:setIamPolicy',body: '*',}], + },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/locations/*/caPools/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/certificateTemplates/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/caPools/*/certificateAuthorities/*/certificateRevocationLists/*}:testIamPermissions',body: '*',}], + },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const activateCertificateAuthorityResponse = protoFilesRoot.lookup( + '.google.cloud.security.privateca.v1.CertificateAuthority') as gax.protobuf.Type; + const activateCertificateAuthorityMetadata = protoFilesRoot.lookup( + '.google.cloud.security.privateca.v1.OperationMetadata') as gax.protobuf.Type; + const createCertificateAuthorityResponse = protoFilesRoot.lookup( + '.google.cloud.security.privateca.v1.CertificateAuthority') as gax.protobuf.Type; + const createCertificateAuthorityMetadata = protoFilesRoot.lookup( + '.google.cloud.security.privateca.v1.OperationMetadata') as gax.protobuf.Type; + const disableCertificateAuthorityResponse = protoFilesRoot.lookup( + '.google.cloud.security.privateca.v1.CertificateAuthority') as gax.protobuf.Type; + const disableCertificateAuthorityMetadata = protoFilesRoot.lookup( + '.google.cloud.security.privateca.v1.OperationMetadata') as gax.protobuf.Type; + const enableCertificateAuthorityResponse = protoFilesRoot.lookup( + '.google.cloud.security.privateca.v1.CertificateAuthority') as gax.protobuf.Type; + const enableCertificateAuthorityMetadata = protoFilesRoot.lookup( + '.google.cloud.security.privateca.v1.OperationMetadata') as gax.protobuf.Type; + const undeleteCertificateAuthorityResponse = protoFilesRoot.lookup( + '.google.cloud.security.privateca.v1.CertificateAuthority') as gax.protobuf.Type; + const undeleteCertificateAuthorityMetadata = protoFilesRoot.lookup( + '.google.cloud.security.privateca.v1.OperationMetadata') as gax.protobuf.Type; + const deleteCertificateAuthorityResponse = protoFilesRoot.lookup( + '.google.cloud.security.privateca.v1.CertificateAuthority') as gax.protobuf.Type; + const deleteCertificateAuthorityMetadata = protoFilesRoot.lookup( + '.google.cloud.security.privateca.v1.OperationMetadata') as gax.protobuf.Type; + const updateCertificateAuthorityResponse = protoFilesRoot.lookup( + '.google.cloud.security.privateca.v1.CertificateAuthority') as gax.protobuf.Type; + const updateCertificateAuthorityMetadata = protoFilesRoot.lookup( + '.google.cloud.security.privateca.v1.OperationMetadata') as gax.protobuf.Type; + const createCaPoolResponse = protoFilesRoot.lookup( + '.google.cloud.security.privateca.v1.CaPool') as gax.protobuf.Type; + const createCaPoolMetadata = protoFilesRoot.lookup( + '.google.cloud.security.privateca.v1.OperationMetadata') as gax.protobuf.Type; + const updateCaPoolResponse = protoFilesRoot.lookup( + '.google.cloud.security.privateca.v1.CaPool') as gax.protobuf.Type; + const updateCaPoolMetadata = protoFilesRoot.lookup( + '.google.cloud.security.privateca.v1.OperationMetadata') as gax.protobuf.Type; + const deleteCaPoolResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteCaPoolMetadata = protoFilesRoot.lookup( + '.google.cloud.security.privateca.v1.OperationMetadata') as gax.protobuf.Type; + const updateCertificateRevocationListResponse = protoFilesRoot.lookup( + '.google.cloud.security.privateca.v1.CertificateRevocationList') as gax.protobuf.Type; + const updateCertificateRevocationListMetadata = protoFilesRoot.lookup( + '.google.cloud.security.privateca.v1.OperationMetadata') as gax.protobuf.Type; + const createCertificateTemplateResponse = protoFilesRoot.lookup( + '.google.cloud.security.privateca.v1.CertificateTemplate') as gax.protobuf.Type; + const createCertificateTemplateMetadata = protoFilesRoot.lookup( + '.google.cloud.security.privateca.v1.OperationMetadata') as gax.protobuf.Type; + const deleteCertificateTemplateResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteCertificateTemplateMetadata = protoFilesRoot.lookup( + '.google.cloud.security.privateca.v1.OperationMetadata') as gax.protobuf.Type; + const updateCertificateTemplateResponse = protoFilesRoot.lookup( + '.google.cloud.security.privateca.v1.CertificateTemplate') as gax.protobuf.Type; + const updateCertificateTemplateMetadata = protoFilesRoot.lookup( + '.google.cloud.security.privateca.v1.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + activateCertificateAuthority: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + activateCertificateAuthorityResponse.decode.bind(activateCertificateAuthorityResponse), + activateCertificateAuthorityMetadata.decode.bind(activateCertificateAuthorityMetadata)), + createCertificateAuthority: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createCertificateAuthorityResponse.decode.bind(createCertificateAuthorityResponse), + createCertificateAuthorityMetadata.decode.bind(createCertificateAuthorityMetadata)), + disableCertificateAuthority: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + disableCertificateAuthorityResponse.decode.bind(disableCertificateAuthorityResponse), + disableCertificateAuthorityMetadata.decode.bind(disableCertificateAuthorityMetadata)), + enableCertificateAuthority: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + enableCertificateAuthorityResponse.decode.bind(enableCertificateAuthorityResponse), + enableCertificateAuthorityMetadata.decode.bind(enableCertificateAuthorityMetadata)), + undeleteCertificateAuthority: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + undeleteCertificateAuthorityResponse.decode.bind(undeleteCertificateAuthorityResponse), + undeleteCertificateAuthorityMetadata.decode.bind(undeleteCertificateAuthorityMetadata)), + deleteCertificateAuthority: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteCertificateAuthorityResponse.decode.bind(deleteCertificateAuthorityResponse), + deleteCertificateAuthorityMetadata.decode.bind(deleteCertificateAuthorityMetadata)), + updateCertificateAuthority: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateCertificateAuthorityResponse.decode.bind(updateCertificateAuthorityResponse), + updateCertificateAuthorityMetadata.decode.bind(updateCertificateAuthorityMetadata)), + createCaPool: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createCaPoolResponse.decode.bind(createCaPoolResponse), + createCaPoolMetadata.decode.bind(createCaPoolMetadata)), + updateCaPool: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateCaPoolResponse.decode.bind(updateCaPoolResponse), + updateCaPoolMetadata.decode.bind(updateCaPoolMetadata)), + deleteCaPool: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteCaPoolResponse.decode.bind(deleteCaPoolResponse), + deleteCaPoolMetadata.decode.bind(deleteCaPoolMetadata)), + updateCertificateRevocationList: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateCertificateRevocationListResponse.decode.bind(updateCertificateRevocationListResponse), + updateCertificateRevocationListMetadata.decode.bind(updateCertificateRevocationListMetadata)), + createCertificateTemplate: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createCertificateTemplateResponse.decode.bind(createCertificateTemplateResponse), + createCertificateTemplateMetadata.decode.bind(createCertificateTemplateMetadata)), + deleteCertificateTemplate: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteCertificateTemplateResponse.decode.bind(deleteCertificateTemplateResponse), + deleteCertificateTemplateMetadata.decode.bind(deleteCertificateTemplateMetadata)), + updateCertificateTemplate: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateCertificateTemplateResponse.decode.bind(updateCertificateTemplateResponse), + updateCertificateTemplateMetadata.decode.bind(updateCertificateTemplateMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.security.privateca.v1.CertificateAuthorityService', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.certificateAuthorityServiceStub) { + return this.certificateAuthorityServiceStub; + } + + // Put together the "service stub" for + // google.cloud.security.privateca.v1.CertificateAuthorityService. + this.certificateAuthorityServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.security.privateca.v1.CertificateAuthorityService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.security.privateca.v1.CertificateAuthorityService, + 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 certificateAuthorityServiceStubMethods = + ['createCertificate', 'getCertificate', 'listCertificates', 'revokeCertificate', 'updateCertificate', 'activateCertificateAuthority', 'createCertificateAuthority', 'disableCertificateAuthority', 'enableCertificateAuthority', 'fetchCertificateAuthorityCsr', 'getCertificateAuthority', 'listCertificateAuthorities', 'undeleteCertificateAuthority', 'deleteCertificateAuthority', 'updateCertificateAuthority', 'createCaPool', 'updateCaPool', 'getCaPool', 'listCaPools', 'deleteCaPool', 'fetchCaCerts', 'getCertificateRevocationList', 'listCertificateRevocationLists', 'updateCertificateRevocationList', 'createCertificateTemplate', 'deleteCertificateTemplate', 'getCertificateTemplate', 'listCertificateTemplates', 'updateCertificateTemplate']; + for (const methodName of certificateAuthorityServiceStubMethods) { + const callPromise = this.certificateAuthorityServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.certificateAuthorityServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'privateca.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 'privateca.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- +/** + * Create a new {@link google.cloud.security.privateca.v1.Certificate|Certificate} in a given Project, Location from a particular + * {@link google.cloud.security.privateca.v1.CaPool|CaPool}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the {@link google.cloud.security.privateca.v1.CaPool|CaPool} associated with the {@link google.cloud.security.privateca.v1.Certificate|Certificate}, + * in the format `projects/* /locations/* /caPools/*`. + * @param {string} [request.certificateId] + * Optional. It must be unique within a location and match the regular + * expression `[a-zA-Z0-9_-]{1,63}`. This field is required when using a + * {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthority} in the Enterprise {@link |CertificateAuthority.Tier}, + * but is optional and its value is ignored otherwise. + * @param {google.cloud.security.privateca.v1.Certificate} request.certificate + * Required. A {@link google.cloud.security.privateca.v1.Certificate|Certificate} with initial field values. + * @param {string} [request.requestId] + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {boolean} [request.validateOnly] + * Optional. If this is true, no {@link google.cloud.security.privateca.v1.Certificate|Certificate} resource will be persisted regardless + * of the {@link google.cloud.security.privateca.v1.CaPool|CaPool}'s {@link google.cloud.security.privateca.v1.CaPool.tier|tier}, and the returned {@link google.cloud.security.privateca.v1.Certificate|Certificate} + * will not contain the {@link google.cloud.security.privateca.v1.Certificate.pem_certificate|pem_certificate} field. + * @param {string} [request.issuingCertificateAuthorityId] + * Optional. The resource ID of the {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthority} that should issue the + * certificate. This optional field will ignore the load-balancing scheme of + * the Pool and directly issue the certificate from the CA with the specified + * ID, contained in the same {@link google.cloud.security.privateca.v1.CaPool|CaPool} referenced by `parent`. Per-CA quota + * rules apply. If left empty, a {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthority} will be chosen from + * the {@link google.cloud.security.privateca.v1.CaPool|CaPool} by the service. For example, to issue a {@link google.cloud.security.privateca.v1.Certificate|Certificate} from + * a Certificate Authority with resource name + * "projects/my-project/locations/us-central1/caPools/my-pool/certificateAuthorities/my-ca", + * you can set the {@link google.cloud.security.privateca.v1.CreateCertificateRequest.parent|parent} to + * "projects/my-project/locations/us-central1/caPools/my-pool" and the + * {@link google.cloud.security.privateca.v1.CreateCertificateRequest.issuing_certificate_authority_id|issuing_certificate_authority_id} to "my-ca". + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [Certificate]{@link google.cloud.security.privateca.v1.Certificate}. + * 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/certificate_authority_service.create_certificate.js + * region_tag:privateca_v1_generated_CertificateAuthorityService_CreateCertificate_async + */ + createCertificate( + request?: protos.google.cloud.security.privateca.v1.ICreateCertificateRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.security.privateca.v1.ICertificate, + protos.google.cloud.security.privateca.v1.ICreateCertificateRequest|undefined, {}|undefined + ]>; + createCertificate( + request: protos.google.cloud.security.privateca.v1.ICreateCertificateRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.security.privateca.v1.ICertificate, + protos.google.cloud.security.privateca.v1.ICreateCertificateRequest|null|undefined, + {}|null|undefined>): void; + createCertificate( + request: protos.google.cloud.security.privateca.v1.ICreateCertificateRequest, + callback: Callback< + protos.google.cloud.security.privateca.v1.ICertificate, + protos.google.cloud.security.privateca.v1.ICreateCertificateRequest|null|undefined, + {}|null|undefined>): void; + createCertificate( + request?: protos.google.cloud.security.privateca.v1.ICreateCertificateRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.security.privateca.v1.ICertificate, + protos.google.cloud.security.privateca.v1.ICreateCertificateRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.security.privateca.v1.ICertificate, + protos.google.cloud.security.privateca.v1.ICreateCertificateRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.security.privateca.v1.ICertificate, + protos.google.cloud.security.privateca.v1.ICreateCertificateRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createCertificate(request, options, callback); + } +/** + * Returns a {@link google.cloud.security.privateca.v1.Certificate|Certificate}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The {@link google.cloud.security.privateca.v1.Certificate.name|name} of the {@link google.cloud.security.privateca.v1.Certificate|Certificate} 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 [Certificate]{@link google.cloud.security.privateca.v1.Certificate}. + * 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/certificate_authority_service.get_certificate.js + * region_tag:privateca_v1_generated_CertificateAuthorityService_GetCertificate_async + */ + getCertificate( + request?: protos.google.cloud.security.privateca.v1.IGetCertificateRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.security.privateca.v1.ICertificate, + protos.google.cloud.security.privateca.v1.IGetCertificateRequest|undefined, {}|undefined + ]>; + getCertificate( + request: protos.google.cloud.security.privateca.v1.IGetCertificateRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.security.privateca.v1.ICertificate, + protos.google.cloud.security.privateca.v1.IGetCertificateRequest|null|undefined, + {}|null|undefined>): void; + getCertificate( + request: protos.google.cloud.security.privateca.v1.IGetCertificateRequest, + callback: Callback< + protos.google.cloud.security.privateca.v1.ICertificate, + protos.google.cloud.security.privateca.v1.IGetCertificateRequest|null|undefined, + {}|null|undefined>): void; + getCertificate( + request?: protos.google.cloud.security.privateca.v1.IGetCertificateRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.security.privateca.v1.ICertificate, + protos.google.cloud.security.privateca.v1.IGetCertificateRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.security.privateca.v1.ICertificate, + protos.google.cloud.security.privateca.v1.IGetCertificateRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.security.privateca.v1.ICertificate, + protos.google.cloud.security.privateca.v1.IGetCertificateRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getCertificate(request, options, callback); + } +/** + * Revoke a {@link google.cloud.security.privateca.v1.Certificate|Certificate}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name for this {@link google.cloud.security.privateca.v1.Certificate|Certificate} in the + * format + * `projects/* /locations/* /caPools/* /certificates/*`. + * @param {google.cloud.security.privateca.v1.RevocationReason} request.reason + * Required. The {@link google.cloud.security.privateca.v1.RevocationReason|RevocationReason} for revoking this certificate. + * @param {string} [request.requestId] + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [Certificate]{@link google.cloud.security.privateca.v1.Certificate}. + * 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/certificate_authority_service.revoke_certificate.js + * region_tag:privateca_v1_generated_CertificateAuthorityService_RevokeCertificate_async + */ + revokeCertificate( + request?: protos.google.cloud.security.privateca.v1.IRevokeCertificateRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.security.privateca.v1.ICertificate, + protos.google.cloud.security.privateca.v1.IRevokeCertificateRequest|undefined, {}|undefined + ]>; + revokeCertificate( + request: protos.google.cloud.security.privateca.v1.IRevokeCertificateRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.security.privateca.v1.ICertificate, + protos.google.cloud.security.privateca.v1.IRevokeCertificateRequest|null|undefined, + {}|null|undefined>): void; + revokeCertificate( + request: protos.google.cloud.security.privateca.v1.IRevokeCertificateRequest, + callback: Callback< + protos.google.cloud.security.privateca.v1.ICertificate, + protos.google.cloud.security.privateca.v1.IRevokeCertificateRequest|null|undefined, + {}|null|undefined>): void; + revokeCertificate( + request?: protos.google.cloud.security.privateca.v1.IRevokeCertificateRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.security.privateca.v1.ICertificate, + protos.google.cloud.security.privateca.v1.IRevokeCertificateRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.security.privateca.v1.ICertificate, + protos.google.cloud.security.privateca.v1.IRevokeCertificateRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.security.privateca.v1.ICertificate, + protos.google.cloud.security.privateca.v1.IRevokeCertificateRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.revokeCertificate(request, options, callback); + } +/** + * Update a {@link google.cloud.security.privateca.v1.Certificate|Certificate}. Currently, the only field you can update is the + * {@link google.cloud.security.privateca.v1.Certificate.labels|labels} field. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.security.privateca.v1.Certificate} request.certificate + * Required. {@link google.cloud.security.privateca.v1.Certificate|Certificate} with updated values. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. A list of fields to be updated in this request. + * @param {string} [request.requestId] + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [Certificate]{@link google.cloud.security.privateca.v1.Certificate}. + * 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/certificate_authority_service.update_certificate.js + * region_tag:privateca_v1_generated_CertificateAuthorityService_UpdateCertificate_async + */ + updateCertificate( + request?: protos.google.cloud.security.privateca.v1.IUpdateCertificateRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.security.privateca.v1.ICertificate, + protos.google.cloud.security.privateca.v1.IUpdateCertificateRequest|undefined, {}|undefined + ]>; + updateCertificate( + request: protos.google.cloud.security.privateca.v1.IUpdateCertificateRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.security.privateca.v1.ICertificate, + protos.google.cloud.security.privateca.v1.IUpdateCertificateRequest|null|undefined, + {}|null|undefined>): void; + updateCertificate( + request: protos.google.cloud.security.privateca.v1.IUpdateCertificateRequest, + callback: Callback< + protos.google.cloud.security.privateca.v1.ICertificate, + protos.google.cloud.security.privateca.v1.IUpdateCertificateRequest|null|undefined, + {}|null|undefined>): void; + updateCertificate( + request?: protos.google.cloud.security.privateca.v1.IUpdateCertificateRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.security.privateca.v1.ICertificate, + protos.google.cloud.security.privateca.v1.IUpdateCertificateRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.security.privateca.v1.ICertificate, + protos.google.cloud.security.privateca.v1.IUpdateCertificateRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.security.privateca.v1.ICertificate, + protos.google.cloud.security.privateca.v1.IUpdateCertificateRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'certificate.name': request.certificate!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateCertificate(request, options, callback); + } +/** + * Fetch a certificate signing request (CSR) from a {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthority} + * that is in state + * {@link google.cloud.security.privateca.v1.CertificateAuthority.State.AWAITING_USER_ACTIVATION|AWAITING_USER_ACTIVATION} + * and is of type {@link google.cloud.security.privateca.v1.CertificateAuthority.Type.SUBORDINATE|SUBORDINATE}. The + * CSR must then be signed by the desired parent Certificate Authority, which + * could be another {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthority} resource, or could be an on-prem + * certificate authority. See also {@link google.cloud.security.privateca.v1.CertificateAuthorityService.ActivateCertificateAuthority|ActivateCertificateAuthority}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name for this {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthority} in the + * format `projects/* /locations/* /caPools/* /certificateAuthorities/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [FetchCertificateAuthorityCsrResponse]{@link google.cloud.security.privateca.v1.FetchCertificateAuthorityCsrResponse}. + * 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/certificate_authority_service.fetch_certificate_authority_csr.js + * region_tag:privateca_v1_generated_CertificateAuthorityService_FetchCertificateAuthorityCsr_async + */ + fetchCertificateAuthorityCsr( + request?: protos.google.cloud.security.privateca.v1.IFetchCertificateAuthorityCsrRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.security.privateca.v1.IFetchCertificateAuthorityCsrResponse, + protos.google.cloud.security.privateca.v1.IFetchCertificateAuthorityCsrRequest|undefined, {}|undefined + ]>; + fetchCertificateAuthorityCsr( + request: protos.google.cloud.security.privateca.v1.IFetchCertificateAuthorityCsrRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.security.privateca.v1.IFetchCertificateAuthorityCsrResponse, + protos.google.cloud.security.privateca.v1.IFetchCertificateAuthorityCsrRequest|null|undefined, + {}|null|undefined>): void; + fetchCertificateAuthorityCsr( + request: protos.google.cloud.security.privateca.v1.IFetchCertificateAuthorityCsrRequest, + callback: Callback< + protos.google.cloud.security.privateca.v1.IFetchCertificateAuthorityCsrResponse, + protos.google.cloud.security.privateca.v1.IFetchCertificateAuthorityCsrRequest|null|undefined, + {}|null|undefined>): void; + fetchCertificateAuthorityCsr( + request?: protos.google.cloud.security.privateca.v1.IFetchCertificateAuthorityCsrRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.security.privateca.v1.IFetchCertificateAuthorityCsrResponse, + protos.google.cloud.security.privateca.v1.IFetchCertificateAuthorityCsrRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.security.privateca.v1.IFetchCertificateAuthorityCsrResponse, + protos.google.cloud.security.privateca.v1.IFetchCertificateAuthorityCsrRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.security.privateca.v1.IFetchCertificateAuthorityCsrResponse, + protos.google.cloud.security.privateca.v1.IFetchCertificateAuthorityCsrRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.fetchCertificateAuthorityCsr(request, options, callback); + } +/** + * Returns a {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthority}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The {@link google.cloud.security.privateca.v1.CertificateAuthority.name|name} of the {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthority} 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 [CertificateAuthority]{@link google.cloud.security.privateca.v1.CertificateAuthority}. + * 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/certificate_authority_service.get_certificate_authority.js + * region_tag:privateca_v1_generated_CertificateAuthorityService_GetCertificateAuthority_async + */ + getCertificateAuthority( + request?: protos.google.cloud.security.privateca.v1.IGetCertificateAuthorityRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.security.privateca.v1.ICertificateAuthority, + protos.google.cloud.security.privateca.v1.IGetCertificateAuthorityRequest|undefined, {}|undefined + ]>; + getCertificateAuthority( + request: protos.google.cloud.security.privateca.v1.IGetCertificateAuthorityRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.security.privateca.v1.ICertificateAuthority, + protos.google.cloud.security.privateca.v1.IGetCertificateAuthorityRequest|null|undefined, + {}|null|undefined>): void; + getCertificateAuthority( + request: protos.google.cloud.security.privateca.v1.IGetCertificateAuthorityRequest, + callback: Callback< + protos.google.cloud.security.privateca.v1.ICertificateAuthority, + protos.google.cloud.security.privateca.v1.IGetCertificateAuthorityRequest|null|undefined, + {}|null|undefined>): void; + getCertificateAuthority( + request?: protos.google.cloud.security.privateca.v1.IGetCertificateAuthorityRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.security.privateca.v1.ICertificateAuthority, + protos.google.cloud.security.privateca.v1.IGetCertificateAuthorityRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.security.privateca.v1.ICertificateAuthority, + protos.google.cloud.security.privateca.v1.IGetCertificateAuthorityRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.security.privateca.v1.ICertificateAuthority, + protos.google.cloud.security.privateca.v1.IGetCertificateAuthorityRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getCertificateAuthority(request, options, callback); + } +/** + * Returns a {@link google.cloud.security.privateca.v1.CaPool|CaPool}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The {@link google.cloud.security.privateca.v1.CaPool.name|name} of the {@link google.cloud.security.privateca.v1.CaPool|CaPool} 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 [CaPool]{@link google.cloud.security.privateca.v1.CaPool}. + * 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/certificate_authority_service.get_ca_pool.js + * region_tag:privateca_v1_generated_CertificateAuthorityService_GetCaPool_async + */ + getCaPool( + request?: protos.google.cloud.security.privateca.v1.IGetCaPoolRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.security.privateca.v1.ICaPool, + protos.google.cloud.security.privateca.v1.IGetCaPoolRequest|undefined, {}|undefined + ]>; + getCaPool( + request: protos.google.cloud.security.privateca.v1.IGetCaPoolRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.security.privateca.v1.ICaPool, + protos.google.cloud.security.privateca.v1.IGetCaPoolRequest|null|undefined, + {}|null|undefined>): void; + getCaPool( + request: protos.google.cloud.security.privateca.v1.IGetCaPoolRequest, + callback: Callback< + protos.google.cloud.security.privateca.v1.ICaPool, + protos.google.cloud.security.privateca.v1.IGetCaPoolRequest|null|undefined, + {}|null|undefined>): void; + getCaPool( + request?: protos.google.cloud.security.privateca.v1.IGetCaPoolRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.security.privateca.v1.ICaPool, + protos.google.cloud.security.privateca.v1.IGetCaPoolRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.security.privateca.v1.ICaPool, + protos.google.cloud.security.privateca.v1.IGetCaPoolRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.security.privateca.v1.ICaPool, + protos.google.cloud.security.privateca.v1.IGetCaPoolRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getCaPool(request, options, callback); + } +/** + * FetchCaCerts returns the current trust anchor for the {@link google.cloud.security.privateca.v1.CaPool|CaPool}. This will + * include CA certificate chains for all ACTIVE {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthority} + * resources in the {@link google.cloud.security.privateca.v1.CaPool|CaPool}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.caPool + * Required. The resource name for the {@link google.cloud.security.privateca.v1.CaPool|CaPool} in the + * format `projects/* /locations/* /caPools/*`. + * @param {string} [request.requestId] + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [FetchCaCertsResponse]{@link google.cloud.security.privateca.v1.FetchCaCertsResponse}. + * 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/certificate_authority_service.fetch_ca_certs.js + * region_tag:privateca_v1_generated_CertificateAuthorityService_FetchCaCerts_async + */ + fetchCaCerts( + request?: protos.google.cloud.security.privateca.v1.IFetchCaCertsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.security.privateca.v1.IFetchCaCertsResponse, + protos.google.cloud.security.privateca.v1.IFetchCaCertsRequest|undefined, {}|undefined + ]>; + fetchCaCerts( + request: protos.google.cloud.security.privateca.v1.IFetchCaCertsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.security.privateca.v1.IFetchCaCertsResponse, + protos.google.cloud.security.privateca.v1.IFetchCaCertsRequest|null|undefined, + {}|null|undefined>): void; + fetchCaCerts( + request: protos.google.cloud.security.privateca.v1.IFetchCaCertsRequest, + callback: Callback< + protos.google.cloud.security.privateca.v1.IFetchCaCertsResponse, + protos.google.cloud.security.privateca.v1.IFetchCaCertsRequest|null|undefined, + {}|null|undefined>): void; + fetchCaCerts( + request?: protos.google.cloud.security.privateca.v1.IFetchCaCertsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.security.privateca.v1.IFetchCaCertsResponse, + protos.google.cloud.security.privateca.v1.IFetchCaCertsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.security.privateca.v1.IFetchCaCertsResponse, + protos.google.cloud.security.privateca.v1.IFetchCaCertsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.security.privateca.v1.IFetchCaCertsResponse, + protos.google.cloud.security.privateca.v1.IFetchCaCertsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'ca_pool': request.caPool || '', + }); + this.initialize(); + return this.innerApiCalls.fetchCaCerts(request, options, callback); + } +/** + * Returns a {@link google.cloud.security.privateca.v1.CertificateRevocationList|CertificateRevocationList}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The {@link google.cloud.security.privateca.v1.CertificateRevocationList.name|name} of the + * {@link google.cloud.security.privateca.v1.CertificateRevocationList|CertificateRevocationList} 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 [CertificateRevocationList]{@link google.cloud.security.privateca.v1.CertificateRevocationList}. + * 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/certificate_authority_service.get_certificate_revocation_list.js + * region_tag:privateca_v1_generated_CertificateAuthorityService_GetCertificateRevocationList_async + */ + getCertificateRevocationList( + request?: protos.google.cloud.security.privateca.v1.IGetCertificateRevocationListRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.security.privateca.v1.ICertificateRevocationList, + protos.google.cloud.security.privateca.v1.IGetCertificateRevocationListRequest|undefined, {}|undefined + ]>; + getCertificateRevocationList( + request: protos.google.cloud.security.privateca.v1.IGetCertificateRevocationListRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.security.privateca.v1.ICertificateRevocationList, + protos.google.cloud.security.privateca.v1.IGetCertificateRevocationListRequest|null|undefined, + {}|null|undefined>): void; + getCertificateRevocationList( + request: protos.google.cloud.security.privateca.v1.IGetCertificateRevocationListRequest, + callback: Callback< + protos.google.cloud.security.privateca.v1.ICertificateRevocationList, + protos.google.cloud.security.privateca.v1.IGetCertificateRevocationListRequest|null|undefined, + {}|null|undefined>): void; + getCertificateRevocationList( + request?: protos.google.cloud.security.privateca.v1.IGetCertificateRevocationListRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.security.privateca.v1.ICertificateRevocationList, + protos.google.cloud.security.privateca.v1.IGetCertificateRevocationListRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.security.privateca.v1.ICertificateRevocationList, + protos.google.cloud.security.privateca.v1.IGetCertificateRevocationListRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.security.privateca.v1.ICertificateRevocationList, + protos.google.cloud.security.privateca.v1.IGetCertificateRevocationListRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getCertificateRevocationList(request, options, callback); + } +/** + * Returns a {@link google.cloud.security.privateca.v1.CertificateTemplate|CertificateTemplate}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The {@link google.cloud.security.privateca.v1.CertificateTemplate.name|name} of the {@link google.cloud.security.privateca.v1.CertificateTemplate|CertificateTemplate} 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 [CertificateTemplate]{@link google.cloud.security.privateca.v1.CertificateTemplate}. + * 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/certificate_authority_service.get_certificate_template.js + * region_tag:privateca_v1_generated_CertificateAuthorityService_GetCertificateTemplate_async + */ + getCertificateTemplate( + request?: protos.google.cloud.security.privateca.v1.IGetCertificateTemplateRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.security.privateca.v1.ICertificateTemplate, + protos.google.cloud.security.privateca.v1.IGetCertificateTemplateRequest|undefined, {}|undefined + ]>; + getCertificateTemplate( + request: protos.google.cloud.security.privateca.v1.IGetCertificateTemplateRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.security.privateca.v1.ICertificateTemplate, + protos.google.cloud.security.privateca.v1.IGetCertificateTemplateRequest|null|undefined, + {}|null|undefined>): void; + getCertificateTemplate( + request: protos.google.cloud.security.privateca.v1.IGetCertificateTemplateRequest, + callback: Callback< + protos.google.cloud.security.privateca.v1.ICertificateTemplate, + protos.google.cloud.security.privateca.v1.IGetCertificateTemplateRequest|null|undefined, + {}|null|undefined>): void; + getCertificateTemplate( + request?: protos.google.cloud.security.privateca.v1.IGetCertificateTemplateRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.security.privateca.v1.ICertificateTemplate, + protos.google.cloud.security.privateca.v1.IGetCertificateTemplateRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.security.privateca.v1.ICertificateTemplate, + protos.google.cloud.security.privateca.v1.IGetCertificateTemplateRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.security.privateca.v1.ICertificateTemplate, + protos.google.cloud.security.privateca.v1.IGetCertificateTemplateRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getCertificateTemplate(request, options, callback); + } + +/** + * Activate a {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthority} that is in state + * {@link google.cloud.security.privateca.v1.CertificateAuthority.State.AWAITING_USER_ACTIVATION|AWAITING_USER_ACTIVATION} + * and is of type {@link google.cloud.security.privateca.v1.CertificateAuthority.Type.SUBORDINATE|SUBORDINATE}. After + * the parent Certificate Authority signs a certificate signing request from + * {@link google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCertificateAuthorityCsr|FetchCertificateAuthorityCsr}, this method can complete the activation + * process. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name for this {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthority} in the + * format `projects/* /locations/* /caPools/* /certificateAuthorities/*`. + * @param {string} request.pemCaCertificate + * Required. The signed CA certificate issued from + * {@link google.cloud.security.privateca.v1.FetchCertificateAuthorityCsrResponse.pem_csr|FetchCertificateAuthorityCsrResponse.pem_csr}. + * @param {google.cloud.security.privateca.v1.SubordinateConfig} request.subordinateConfig + * Required. Must include information about the issuer of 'pem_ca_certificate', and any + * further issuers until the self-signed CA. + * @param {string} [request.requestId] + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/certificate_authority_service.activate_certificate_authority.js + * region_tag:privateca_v1_generated_CertificateAuthorityService_ActivateCertificateAuthority_async + */ + activateCertificateAuthority( + request?: protos.google.cloud.security.privateca.v1.IActivateCertificateAuthorityRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + activateCertificateAuthority( + request: protos.google.cloud.security.privateca.v1.IActivateCertificateAuthorityRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + activateCertificateAuthority( + request: protos.google.cloud.security.privateca.v1.IActivateCertificateAuthorityRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + activateCertificateAuthority( + request?: protos.google.cloud.security.privateca.v1.IActivateCertificateAuthorityRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.activateCertificateAuthority(request, options, callback); + } +/** + * Check the status of the long running operation returned by `activateCertificateAuthority()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/certificate_authority_service.activate_certificate_authority.js + * region_tag:privateca_v1_generated_CertificateAuthorityService_ActivateCertificateAuthority_async + */ + async checkActivateCertificateAuthorityProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.activateCertificateAuthority, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Create a new {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthority} 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 {@link google.cloud.security.privateca.v1.CaPool|CaPool} associated with the + * {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthorities}, in the format + * `projects/* /locations/* /caPools/*`. + * @param {string} request.certificateAuthorityId + * Required. It must be unique within a location and match the regular + * expression `[a-zA-Z0-9_-]{1,63}` + * @param {google.cloud.security.privateca.v1.CertificateAuthority} request.certificateAuthority + * Required. A {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthority} with initial field values. + * @param {string} [request.requestId] + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/certificate_authority_service.create_certificate_authority.js + * region_tag:privateca_v1_generated_CertificateAuthorityService_CreateCertificateAuthority_async + */ + createCertificateAuthority( + request?: protos.google.cloud.security.privateca.v1.ICreateCertificateAuthorityRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createCertificateAuthority( + request: protos.google.cloud.security.privateca.v1.ICreateCertificateAuthorityRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createCertificateAuthority( + request: protos.google.cloud.security.privateca.v1.ICreateCertificateAuthorityRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createCertificateAuthority( + request?: protos.google.cloud.security.privateca.v1.ICreateCertificateAuthorityRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createCertificateAuthority(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createCertificateAuthority()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/certificate_authority_service.create_certificate_authority.js + * region_tag:privateca_v1_generated_CertificateAuthorityService_CreateCertificateAuthority_async + */ + async checkCreateCertificateAuthorityProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createCertificateAuthority, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Disable a {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthority}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name for this {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthority} in the + * format `projects/* /locations/* /caPools/* /certificateAuthorities/*`. + * @param {string} [request.requestId] + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/certificate_authority_service.disable_certificate_authority.js + * region_tag:privateca_v1_generated_CertificateAuthorityService_DisableCertificateAuthority_async + */ + disableCertificateAuthority( + request?: protos.google.cloud.security.privateca.v1.IDisableCertificateAuthorityRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + disableCertificateAuthority( + request: protos.google.cloud.security.privateca.v1.IDisableCertificateAuthorityRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + disableCertificateAuthority( + request: protos.google.cloud.security.privateca.v1.IDisableCertificateAuthorityRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + disableCertificateAuthority( + request?: protos.google.cloud.security.privateca.v1.IDisableCertificateAuthorityRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.disableCertificateAuthority(request, options, callback); + } +/** + * Check the status of the long running operation returned by `disableCertificateAuthority()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/certificate_authority_service.disable_certificate_authority.js + * region_tag:privateca_v1_generated_CertificateAuthorityService_DisableCertificateAuthority_async + */ + async checkDisableCertificateAuthorityProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.disableCertificateAuthority, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Enable a {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthority}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name for this {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthority} in the + * format `projects/* /locations/* /caPools/* /certificateAuthorities/*`. + * @param {string} [request.requestId] + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/certificate_authority_service.enable_certificate_authority.js + * region_tag:privateca_v1_generated_CertificateAuthorityService_EnableCertificateAuthority_async + */ + enableCertificateAuthority( + request?: protos.google.cloud.security.privateca.v1.IEnableCertificateAuthorityRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + enableCertificateAuthority( + request: protos.google.cloud.security.privateca.v1.IEnableCertificateAuthorityRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + enableCertificateAuthority( + request: protos.google.cloud.security.privateca.v1.IEnableCertificateAuthorityRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + enableCertificateAuthority( + request?: protos.google.cloud.security.privateca.v1.IEnableCertificateAuthorityRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.enableCertificateAuthority(request, options, callback); + } +/** + * Check the status of the long running operation returned by `enableCertificateAuthority()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/certificate_authority_service.enable_certificate_authority.js + * region_tag:privateca_v1_generated_CertificateAuthorityService_EnableCertificateAuthority_async + */ + async checkEnableCertificateAuthorityProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.enableCertificateAuthority, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Undelete a {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthority} that has been deleted. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name for this {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthority} in the + * format `projects/* /locations/* /caPools/* /certificateAuthorities/*`. + * @param {string} [request.requestId] + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/certificate_authority_service.undelete_certificate_authority.js + * region_tag:privateca_v1_generated_CertificateAuthorityService_UndeleteCertificateAuthority_async + */ + undeleteCertificateAuthority( + request?: protos.google.cloud.security.privateca.v1.IUndeleteCertificateAuthorityRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + undeleteCertificateAuthority( + request: protos.google.cloud.security.privateca.v1.IUndeleteCertificateAuthorityRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + undeleteCertificateAuthority( + request: protos.google.cloud.security.privateca.v1.IUndeleteCertificateAuthorityRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + undeleteCertificateAuthority( + request?: protos.google.cloud.security.privateca.v1.IUndeleteCertificateAuthorityRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.undeleteCertificateAuthority(request, options, callback); + } +/** + * Check the status of the long running operation returned by `undeleteCertificateAuthority()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/certificate_authority_service.undelete_certificate_authority.js + * region_tag:privateca_v1_generated_CertificateAuthorityService_UndeleteCertificateAuthority_async + */ + async checkUndeleteCertificateAuthorityProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.undeleteCertificateAuthority, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Delete a {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthority}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name for this {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthority} in the + * format `projects/* /locations/* /caPools/* /certificateAuthorities/*`. + * @param {string} [request.requestId] + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {boolean} [request.ignoreActiveCertificates] + * Optional. This field allows the CA to be deleted even if the CA has + * active certs. Active certs include both unrevoked and unexpired certs. + * @param {boolean} [request.skipGracePeriod] + * Optional. If this flag is set, the Certificate Authority will be deleted as soon as + * possible without a 30-day grace period where undeletion would have been + * allowed. If you proceed, there will be no way to recover this CA. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/certificate_authority_service.delete_certificate_authority.js + * region_tag:privateca_v1_generated_CertificateAuthorityService_DeleteCertificateAuthority_async + */ + deleteCertificateAuthority( + request?: protos.google.cloud.security.privateca.v1.IDeleteCertificateAuthorityRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteCertificateAuthority( + request: protos.google.cloud.security.privateca.v1.IDeleteCertificateAuthorityRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteCertificateAuthority( + request: protos.google.cloud.security.privateca.v1.IDeleteCertificateAuthorityRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteCertificateAuthority( + request?: protos.google.cloud.security.privateca.v1.IDeleteCertificateAuthorityRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteCertificateAuthority(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteCertificateAuthority()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/certificate_authority_service.delete_certificate_authority.js + * region_tag:privateca_v1_generated_CertificateAuthorityService_DeleteCertificateAuthority_async + */ + async checkDeleteCertificateAuthorityProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.deleteCertificateAuthority, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Update a {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthority}. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.security.privateca.v1.CertificateAuthority} request.certificateAuthority + * Required. {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthority} with updated values. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. A list of fields to be updated in this request. + * @param {string} [request.requestId] + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/certificate_authority_service.update_certificate_authority.js + * region_tag:privateca_v1_generated_CertificateAuthorityService_UpdateCertificateAuthority_async + */ + updateCertificateAuthority( + request?: protos.google.cloud.security.privateca.v1.IUpdateCertificateAuthorityRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateCertificateAuthority( + request: protos.google.cloud.security.privateca.v1.IUpdateCertificateAuthorityRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateCertificateAuthority( + request: protos.google.cloud.security.privateca.v1.IUpdateCertificateAuthorityRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateCertificateAuthority( + request?: protos.google.cloud.security.privateca.v1.IUpdateCertificateAuthorityRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'certificate_authority.name': request.certificateAuthority!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateCertificateAuthority(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateCertificateAuthority()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/certificate_authority_service.update_certificate_authority.js + * region_tag:privateca_v1_generated_CertificateAuthorityService_UpdateCertificateAuthority_async + */ + async checkUpdateCertificateAuthorityProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.updateCertificateAuthority, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Create a {@link google.cloud.security.privateca.v1.CaPool|CaPool}. + * + * @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.security.privateca.v1.CaPool|CaPool}, in the format `projects/* /locations/*`. + * @param {string} request.caPoolId + * Required. It must be unique within a location and match the regular + * expression `[a-zA-Z0-9_-]{1,63}` + * @param {google.cloud.security.privateca.v1.CaPool} request.caPool + * Required. A {@link google.cloud.security.privateca.v1.CaPool|CaPool} with initial field values. + * @param {string} [request.requestId] + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/certificate_authority_service.create_ca_pool.js + * region_tag:privateca_v1_generated_CertificateAuthorityService_CreateCaPool_async + */ + createCaPool( + request?: protos.google.cloud.security.privateca.v1.ICreateCaPoolRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createCaPool( + request: protos.google.cloud.security.privateca.v1.ICreateCaPoolRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createCaPool( + request: protos.google.cloud.security.privateca.v1.ICreateCaPoolRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createCaPool( + request?: protos.google.cloud.security.privateca.v1.ICreateCaPoolRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createCaPool(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createCaPool()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/certificate_authority_service.create_ca_pool.js + * region_tag:privateca_v1_generated_CertificateAuthorityService_CreateCaPool_async + */ + async checkCreateCaPoolProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createCaPool, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Update a {@link google.cloud.security.privateca.v1.CaPool|CaPool}. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.security.privateca.v1.CaPool} request.caPool + * Required. {@link google.cloud.security.privateca.v1.CaPool|CaPool} with updated values. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. A list of fields to be updated in this request. + * @param {string} [request.requestId] + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/certificate_authority_service.update_ca_pool.js + * region_tag:privateca_v1_generated_CertificateAuthorityService_UpdateCaPool_async + */ + updateCaPool( + request?: protos.google.cloud.security.privateca.v1.IUpdateCaPoolRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateCaPool( + request: protos.google.cloud.security.privateca.v1.IUpdateCaPoolRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateCaPool( + request: protos.google.cloud.security.privateca.v1.IUpdateCaPoolRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateCaPool( + request?: protos.google.cloud.security.privateca.v1.IUpdateCaPoolRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'ca_pool.name': request.caPool!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateCaPool(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateCaPool()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/certificate_authority_service.update_ca_pool.js + * region_tag:privateca_v1_generated_CertificateAuthorityService_UpdateCaPool_async + */ + async checkUpdateCaPoolProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.updateCaPool, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Delete a {@link google.cloud.security.privateca.v1.CaPool|CaPool}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name for this {@link google.cloud.security.privateca.v1.CaPool|CaPool} in the + * format `projects/* /locations/* /caPools/*`. + * @param {string} [request.requestId] + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/certificate_authority_service.delete_ca_pool.js + * region_tag:privateca_v1_generated_CertificateAuthorityService_DeleteCaPool_async + */ + deleteCaPool( + request?: protos.google.cloud.security.privateca.v1.IDeleteCaPoolRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteCaPool( + request: protos.google.cloud.security.privateca.v1.IDeleteCaPoolRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteCaPool( + request: protos.google.cloud.security.privateca.v1.IDeleteCaPoolRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteCaPool( + request?: protos.google.cloud.security.privateca.v1.IDeleteCaPoolRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteCaPool(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteCaPool()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/certificate_authority_service.delete_ca_pool.js + * region_tag:privateca_v1_generated_CertificateAuthorityService_DeleteCaPool_async + */ + async checkDeleteCaPoolProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.deleteCaPool, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Update a {@link google.cloud.security.privateca.v1.CertificateRevocationList|CertificateRevocationList}. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.security.privateca.v1.CertificateRevocationList} request.certificateRevocationList + * Required. {@link google.cloud.security.privateca.v1.CertificateRevocationList|CertificateRevocationList} with updated values. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. A list of fields to be updated in this request. + * @param {string} [request.requestId] + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/certificate_authority_service.update_certificate_revocation_list.js + * region_tag:privateca_v1_generated_CertificateAuthorityService_UpdateCertificateRevocationList_async + */ + updateCertificateRevocationList( + request?: protos.google.cloud.security.privateca.v1.IUpdateCertificateRevocationListRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateCertificateRevocationList( + request: protos.google.cloud.security.privateca.v1.IUpdateCertificateRevocationListRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateCertificateRevocationList( + request: protos.google.cloud.security.privateca.v1.IUpdateCertificateRevocationListRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateCertificateRevocationList( + request?: protos.google.cloud.security.privateca.v1.IUpdateCertificateRevocationListRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'certificate_revocation_list.name': request.certificateRevocationList!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateCertificateRevocationList(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateCertificateRevocationList()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/certificate_authority_service.update_certificate_revocation_list.js + * region_tag:privateca_v1_generated_CertificateAuthorityService_UpdateCertificateRevocationList_async + */ + async checkUpdateCertificateRevocationListProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.updateCertificateRevocationList, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Create a new {@link google.cloud.security.privateca.v1.CertificateTemplate|CertificateTemplate} 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.security.privateca.v1.CertificateTemplate|CertificateTemplate}, in the format + * `projects/* /locations/*`. + * @param {string} request.certificateTemplateId + * Required. It must be unique within a location and match the regular + * expression `[a-zA-Z0-9_-]{1,63}` + * @param {google.cloud.security.privateca.v1.CertificateTemplate} request.certificateTemplate + * Required. A {@link google.cloud.security.privateca.v1.CertificateTemplate|CertificateTemplate} with initial field values. + * @param {string} [request.requestId] + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/certificate_authority_service.create_certificate_template.js + * region_tag:privateca_v1_generated_CertificateAuthorityService_CreateCertificateTemplate_async + */ + createCertificateTemplate( + request?: protos.google.cloud.security.privateca.v1.ICreateCertificateTemplateRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createCertificateTemplate( + request: protos.google.cloud.security.privateca.v1.ICreateCertificateTemplateRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createCertificateTemplate( + request: protos.google.cloud.security.privateca.v1.ICreateCertificateTemplateRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createCertificateTemplate( + request?: protos.google.cloud.security.privateca.v1.ICreateCertificateTemplateRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createCertificateTemplate(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createCertificateTemplate()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/certificate_authority_service.create_certificate_template.js + * region_tag:privateca_v1_generated_CertificateAuthorityService_CreateCertificateTemplate_async + */ + async checkCreateCertificateTemplateProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createCertificateTemplate, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * DeleteCertificateTemplate deletes a {@link google.cloud.security.privateca.v1.CertificateTemplate|CertificateTemplate}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name for this {@link google.cloud.security.privateca.v1.CertificateTemplate|CertificateTemplate} in the format + * `projects/* /locations/* /certificateTemplates/*`. + * @param {string} [request.requestId] + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/certificate_authority_service.delete_certificate_template.js + * region_tag:privateca_v1_generated_CertificateAuthorityService_DeleteCertificateTemplate_async + */ + deleteCertificateTemplate( + request?: protos.google.cloud.security.privateca.v1.IDeleteCertificateTemplateRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteCertificateTemplate( + request: protos.google.cloud.security.privateca.v1.IDeleteCertificateTemplateRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteCertificateTemplate( + request: protos.google.cloud.security.privateca.v1.IDeleteCertificateTemplateRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteCertificateTemplate( + request?: protos.google.cloud.security.privateca.v1.IDeleteCertificateTemplateRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteCertificateTemplate(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteCertificateTemplate()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/certificate_authority_service.delete_certificate_template.js + * region_tag:privateca_v1_generated_CertificateAuthorityService_DeleteCertificateTemplate_async + */ + async checkDeleteCertificateTemplateProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.deleteCertificateTemplate, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Update a {@link google.cloud.security.privateca.v1.CertificateTemplate|CertificateTemplate}. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.security.privateca.v1.CertificateTemplate} request.certificateTemplate + * Required. {@link google.cloud.security.privateca.v1.CertificateTemplate|CertificateTemplate} with updated values. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. A list of fields to be updated in this request. + * @param {string} [request.requestId] + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/certificate_authority_service.update_certificate_template.js + * region_tag:privateca_v1_generated_CertificateAuthorityService_UpdateCertificateTemplate_async + */ + updateCertificateTemplate( + request?: protos.google.cloud.security.privateca.v1.IUpdateCertificateTemplateRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateCertificateTemplate( + request: protos.google.cloud.security.privateca.v1.IUpdateCertificateTemplateRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateCertificateTemplate( + request: protos.google.cloud.security.privateca.v1.IUpdateCertificateTemplateRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateCertificateTemplate( + request?: protos.google.cloud.security.privateca.v1.IUpdateCertificateTemplateRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'certificate_template.name': request.certificateTemplate!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateCertificateTemplate(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateCertificateTemplate()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/certificate_authority_service.update_certificate_template.js + * region_tag:privateca_v1_generated_CertificateAuthorityService_UpdateCertificateTemplate_async + */ + async checkUpdateCertificateTemplateProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.updateCertificateTemplate, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists {@link google.cloud.security.privateca.v1.Certificate|Certificates}. + * + * @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.security.privateca.v1.Certificate|Certificates}, in the format + * `projects/* /locations/* /caPools/*`. + * @param {number} [request.pageSize] + * Optional. Limit on the number of + * {@link google.cloud.security.privateca.v1.Certificate|Certificates} to include in the + * response. Further {@link google.cloud.security.privateca.v1.Certificate|Certificates} can subsequently be obtained + * by including the + * {@link google.cloud.security.privateca.v1.ListCertificatesResponse.next_page_token|ListCertificatesResponse.next_page_token} in a subsequent + * request. If unspecified, the server will pick an appropriate default. + * @param {string} [request.pageToken] + * Optional. Pagination token, returned earlier via + * {@link google.cloud.security.privateca.v1.ListCertificatesResponse.next_page_token|ListCertificatesResponse.next_page_token}. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. For details + * on supported filters and syntax, see [Certificates Filtering + * documentation](https://cloud.google.com/certificate-authority-service/docs/sorting-filtering-certificates#filtering_support). + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. For details on supported fields + * and syntax, see [Certificates Sorting + * documentation](https://cloud.google.com/certificate-authority-service/docs/sorting-filtering-certificates#sorting_support). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [Certificate]{@link google.cloud.security.privateca.v1.Certificate}. + * 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 `listCertificatesAsync()` + * 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. + */ + listCertificates( + request?: protos.google.cloud.security.privateca.v1.IListCertificatesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.security.privateca.v1.ICertificate[], + protos.google.cloud.security.privateca.v1.IListCertificatesRequest|null, + protos.google.cloud.security.privateca.v1.IListCertificatesResponse + ]>; + listCertificates( + request: protos.google.cloud.security.privateca.v1.IListCertificatesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.security.privateca.v1.IListCertificatesRequest, + protos.google.cloud.security.privateca.v1.IListCertificatesResponse|null|undefined, + protos.google.cloud.security.privateca.v1.ICertificate>): void; + listCertificates( + request: protos.google.cloud.security.privateca.v1.IListCertificatesRequest, + callback: PaginationCallback< + protos.google.cloud.security.privateca.v1.IListCertificatesRequest, + protos.google.cloud.security.privateca.v1.IListCertificatesResponse|null|undefined, + protos.google.cloud.security.privateca.v1.ICertificate>): void; + listCertificates( + request?: protos.google.cloud.security.privateca.v1.IListCertificatesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.security.privateca.v1.IListCertificatesRequest, + protos.google.cloud.security.privateca.v1.IListCertificatesResponse|null|undefined, + protos.google.cloud.security.privateca.v1.ICertificate>, + callback?: PaginationCallback< + protos.google.cloud.security.privateca.v1.IListCertificatesRequest, + protos.google.cloud.security.privateca.v1.IListCertificatesResponse|null|undefined, + protos.google.cloud.security.privateca.v1.ICertificate>): + Promise<[ + protos.google.cloud.security.privateca.v1.ICertificate[], + protos.google.cloud.security.privateca.v1.IListCertificatesRequest|null, + protos.google.cloud.security.privateca.v1.IListCertificatesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listCertificates(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.security.privateca.v1.Certificate|Certificates}, in the format + * `projects/* /locations/* /caPools/*`. + * @param {number} [request.pageSize] + * Optional. Limit on the number of + * {@link google.cloud.security.privateca.v1.Certificate|Certificates} to include in the + * response. Further {@link google.cloud.security.privateca.v1.Certificate|Certificates} can subsequently be obtained + * by including the + * {@link google.cloud.security.privateca.v1.ListCertificatesResponse.next_page_token|ListCertificatesResponse.next_page_token} in a subsequent + * request. If unspecified, the server will pick an appropriate default. + * @param {string} [request.pageToken] + * Optional. Pagination token, returned earlier via + * {@link google.cloud.security.privateca.v1.ListCertificatesResponse.next_page_token|ListCertificatesResponse.next_page_token}. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. For details + * on supported filters and syntax, see [Certificates Filtering + * documentation](https://cloud.google.com/certificate-authority-service/docs/sorting-filtering-certificates#filtering_support). + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. For details on supported fields + * and syntax, see [Certificates Sorting + * documentation](https://cloud.google.com/certificate-authority-service/docs/sorting-filtering-certificates#sorting_support). + * @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 [Certificate]{@link google.cloud.security.privateca.v1.Certificate} 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 `listCertificatesAsync()` + * 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. + */ + listCertificatesStream( + request?: protos.google.cloud.security.privateca.v1.IListCertificatesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listCertificates']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listCertificates.createStream( + this.innerApiCalls.listCertificates as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listCertificates`, 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.security.privateca.v1.Certificate|Certificates}, in the format + * `projects/* /locations/* /caPools/*`. + * @param {number} [request.pageSize] + * Optional. Limit on the number of + * {@link google.cloud.security.privateca.v1.Certificate|Certificates} to include in the + * response. Further {@link google.cloud.security.privateca.v1.Certificate|Certificates} can subsequently be obtained + * by including the + * {@link google.cloud.security.privateca.v1.ListCertificatesResponse.next_page_token|ListCertificatesResponse.next_page_token} in a subsequent + * request. If unspecified, the server will pick an appropriate default. + * @param {string} [request.pageToken] + * Optional. Pagination token, returned earlier via + * {@link google.cloud.security.privateca.v1.ListCertificatesResponse.next_page_token|ListCertificatesResponse.next_page_token}. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. For details + * on supported filters and syntax, see [Certificates Filtering + * documentation](https://cloud.google.com/certificate-authority-service/docs/sorting-filtering-certificates#filtering_support). + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. For details on supported fields + * and syntax, see [Certificates Sorting + * documentation](https://cloud.google.com/certificate-authority-service/docs/sorting-filtering-certificates#sorting_support). + * @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 + * [Certificate]{@link google.cloud.security.privateca.v1.Certificate}. 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/certificate_authority_service.list_certificates.js + * region_tag:privateca_v1_generated_CertificateAuthorityService_ListCertificates_async + */ + listCertificatesAsync( + request?: protos.google.cloud.security.privateca.v1.IListCertificatesRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listCertificates']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listCertificates.asyncIterate( + this.innerApiCalls['listCertificates'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + /** + * Lists {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthorities}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the {@link google.cloud.security.privateca.v1.CaPool|CaPool} associated with the + * {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthorities}, in the format + * `projects/* /locations/* /caPools/*`. + * @param {number} [request.pageSize] + * Optional. Limit on the number of {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthorities} to + * include in the response. + * Further {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthorities} can subsequently be + * obtained by including the + * {@link google.cloud.security.privateca.v1.ListCertificateAuthoritiesResponse.next_page_token|ListCertificateAuthoritiesResponse.next_page_token} in a subsequent + * request. If unspecified, the server will pick an appropriate default. + * @param {string} [request.pageToken] + * Optional. Pagination token, returned earlier via + * {@link google.cloud.security.privateca.v1.ListCertificateAuthoritiesResponse.next_page_token|ListCertificateAuthoritiesResponse.next_page_token}. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [CertificateAuthority]{@link google.cloud.security.privateca.v1.CertificateAuthority}. + * 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 `listCertificateAuthoritiesAsync()` + * 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. + */ + listCertificateAuthorities( + request?: protos.google.cloud.security.privateca.v1.IListCertificateAuthoritiesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.security.privateca.v1.ICertificateAuthority[], + protos.google.cloud.security.privateca.v1.IListCertificateAuthoritiesRequest|null, + protos.google.cloud.security.privateca.v1.IListCertificateAuthoritiesResponse + ]>; + listCertificateAuthorities( + request: protos.google.cloud.security.privateca.v1.IListCertificateAuthoritiesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.security.privateca.v1.IListCertificateAuthoritiesRequest, + protos.google.cloud.security.privateca.v1.IListCertificateAuthoritiesResponse|null|undefined, + protos.google.cloud.security.privateca.v1.ICertificateAuthority>): void; + listCertificateAuthorities( + request: protos.google.cloud.security.privateca.v1.IListCertificateAuthoritiesRequest, + callback: PaginationCallback< + protos.google.cloud.security.privateca.v1.IListCertificateAuthoritiesRequest, + protos.google.cloud.security.privateca.v1.IListCertificateAuthoritiesResponse|null|undefined, + protos.google.cloud.security.privateca.v1.ICertificateAuthority>): void; + listCertificateAuthorities( + request?: protos.google.cloud.security.privateca.v1.IListCertificateAuthoritiesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.security.privateca.v1.IListCertificateAuthoritiesRequest, + protos.google.cloud.security.privateca.v1.IListCertificateAuthoritiesResponse|null|undefined, + protos.google.cloud.security.privateca.v1.ICertificateAuthority>, + callback?: PaginationCallback< + protos.google.cloud.security.privateca.v1.IListCertificateAuthoritiesRequest, + protos.google.cloud.security.privateca.v1.IListCertificateAuthoritiesResponse|null|undefined, + protos.google.cloud.security.privateca.v1.ICertificateAuthority>): + Promise<[ + protos.google.cloud.security.privateca.v1.ICertificateAuthority[], + protos.google.cloud.security.privateca.v1.IListCertificateAuthoritiesRequest|null, + protos.google.cloud.security.privateca.v1.IListCertificateAuthoritiesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listCertificateAuthorities(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.security.privateca.v1.CaPool|CaPool} associated with the + * {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthorities}, in the format + * `projects/* /locations/* /caPools/*`. + * @param {number} [request.pageSize] + * Optional. Limit on the number of {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthorities} to + * include in the response. + * Further {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthorities} can subsequently be + * obtained by including the + * {@link google.cloud.security.privateca.v1.ListCertificateAuthoritiesResponse.next_page_token|ListCertificateAuthoritiesResponse.next_page_token} in a subsequent + * request. If unspecified, the server will pick an appropriate default. + * @param {string} [request.pageToken] + * Optional. Pagination token, returned earlier via + * {@link google.cloud.security.privateca.v1.ListCertificateAuthoritiesResponse.next_page_token|ListCertificateAuthoritiesResponse.next_page_token}. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. + * @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 [CertificateAuthority]{@link google.cloud.security.privateca.v1.CertificateAuthority} 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 `listCertificateAuthoritiesAsync()` + * 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. + */ + listCertificateAuthoritiesStream( + request?: protos.google.cloud.security.privateca.v1.IListCertificateAuthoritiesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listCertificateAuthorities']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listCertificateAuthorities.createStream( + this.innerApiCalls.listCertificateAuthorities as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listCertificateAuthorities`, 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.security.privateca.v1.CaPool|CaPool} associated with the + * {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthorities}, in the format + * `projects/* /locations/* /caPools/*`. + * @param {number} [request.pageSize] + * Optional. Limit on the number of {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthorities} to + * include in the response. + * Further {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthorities} can subsequently be + * obtained by including the + * {@link google.cloud.security.privateca.v1.ListCertificateAuthoritiesResponse.next_page_token|ListCertificateAuthoritiesResponse.next_page_token} in a subsequent + * request. If unspecified, the server will pick an appropriate default. + * @param {string} [request.pageToken] + * Optional. Pagination token, returned earlier via + * {@link google.cloud.security.privateca.v1.ListCertificateAuthoritiesResponse.next_page_token|ListCertificateAuthoritiesResponse.next_page_token}. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. + * @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 + * [CertificateAuthority]{@link google.cloud.security.privateca.v1.CertificateAuthority}. 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/certificate_authority_service.list_certificate_authorities.js + * region_tag:privateca_v1_generated_CertificateAuthorityService_ListCertificateAuthorities_async + */ + listCertificateAuthoritiesAsync( + request?: protos.google.cloud.security.privateca.v1.IListCertificateAuthoritiesRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listCertificateAuthorities']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listCertificateAuthorities.asyncIterate( + this.innerApiCalls['listCertificateAuthorities'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + /** + * Lists {@link google.cloud.security.privateca.v1.CaPool|CaPools}. + * + * @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.security.privateca.v1.CaPool|CaPools}, in the format + * `projects/* /locations/*`. + * @param {number} [request.pageSize] + * Optional. Limit on the number of {@link google.cloud.security.privateca.v1.CaPool|CaPools} to + * include in the response. + * Further {@link google.cloud.security.privateca.v1.CaPool|CaPools} can subsequently be + * obtained by including the + * {@link google.cloud.security.privateca.v1.ListCaPoolsResponse.next_page_token|ListCaPoolsResponse.next_page_token} in a subsequent + * request. If unspecified, the server will pick an appropriate default. + * @param {string} [request.pageToken] + * Optional. Pagination token, returned earlier via + * {@link google.cloud.security.privateca.v1.ListCaPoolsResponse.next_page_token|ListCaPoolsResponse.next_page_token}. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [CaPool]{@link google.cloud.security.privateca.v1.CaPool}. + * 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 `listCaPoolsAsync()` + * 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. + */ + listCaPools( + request?: protos.google.cloud.security.privateca.v1.IListCaPoolsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.security.privateca.v1.ICaPool[], + protos.google.cloud.security.privateca.v1.IListCaPoolsRequest|null, + protos.google.cloud.security.privateca.v1.IListCaPoolsResponse + ]>; + listCaPools( + request: protos.google.cloud.security.privateca.v1.IListCaPoolsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.security.privateca.v1.IListCaPoolsRequest, + protos.google.cloud.security.privateca.v1.IListCaPoolsResponse|null|undefined, + protos.google.cloud.security.privateca.v1.ICaPool>): void; + listCaPools( + request: protos.google.cloud.security.privateca.v1.IListCaPoolsRequest, + callback: PaginationCallback< + protos.google.cloud.security.privateca.v1.IListCaPoolsRequest, + protos.google.cloud.security.privateca.v1.IListCaPoolsResponse|null|undefined, + protos.google.cloud.security.privateca.v1.ICaPool>): void; + listCaPools( + request?: protos.google.cloud.security.privateca.v1.IListCaPoolsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.security.privateca.v1.IListCaPoolsRequest, + protos.google.cloud.security.privateca.v1.IListCaPoolsResponse|null|undefined, + protos.google.cloud.security.privateca.v1.ICaPool>, + callback?: PaginationCallback< + protos.google.cloud.security.privateca.v1.IListCaPoolsRequest, + protos.google.cloud.security.privateca.v1.IListCaPoolsResponse|null|undefined, + protos.google.cloud.security.privateca.v1.ICaPool>): + Promise<[ + protos.google.cloud.security.privateca.v1.ICaPool[], + protos.google.cloud.security.privateca.v1.IListCaPoolsRequest|null, + protos.google.cloud.security.privateca.v1.IListCaPoolsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listCaPools(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.security.privateca.v1.CaPool|CaPools}, in the format + * `projects/* /locations/*`. + * @param {number} [request.pageSize] + * Optional. Limit on the number of {@link google.cloud.security.privateca.v1.CaPool|CaPools} to + * include in the response. + * Further {@link google.cloud.security.privateca.v1.CaPool|CaPools} can subsequently be + * obtained by including the + * {@link google.cloud.security.privateca.v1.ListCaPoolsResponse.next_page_token|ListCaPoolsResponse.next_page_token} in a subsequent + * request. If unspecified, the server will pick an appropriate default. + * @param {string} [request.pageToken] + * Optional. Pagination token, returned earlier via + * {@link google.cloud.security.privateca.v1.ListCaPoolsResponse.next_page_token|ListCaPoolsResponse.next_page_token}. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. + * @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 [CaPool]{@link google.cloud.security.privateca.v1.CaPool} 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 `listCaPoolsAsync()` + * 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. + */ + listCaPoolsStream( + request?: protos.google.cloud.security.privateca.v1.IListCaPoolsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listCaPools']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listCaPools.createStream( + this.innerApiCalls.listCaPools as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listCaPools`, 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.security.privateca.v1.CaPool|CaPools}, in the format + * `projects/* /locations/*`. + * @param {number} [request.pageSize] + * Optional. Limit on the number of {@link google.cloud.security.privateca.v1.CaPool|CaPools} to + * include in the response. + * Further {@link google.cloud.security.privateca.v1.CaPool|CaPools} can subsequently be + * obtained by including the + * {@link google.cloud.security.privateca.v1.ListCaPoolsResponse.next_page_token|ListCaPoolsResponse.next_page_token} in a subsequent + * request. If unspecified, the server will pick an appropriate default. + * @param {string} [request.pageToken] + * Optional. Pagination token, returned earlier via + * {@link google.cloud.security.privateca.v1.ListCaPoolsResponse.next_page_token|ListCaPoolsResponse.next_page_token}. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. + * @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 + * [CaPool]{@link google.cloud.security.privateca.v1.CaPool}. 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/certificate_authority_service.list_ca_pools.js + * region_tag:privateca_v1_generated_CertificateAuthorityService_ListCaPools_async + */ + listCaPoolsAsync( + request?: protos.google.cloud.security.privateca.v1.IListCaPoolsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listCaPools']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listCaPools.asyncIterate( + this.innerApiCalls['listCaPools'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + /** + * Lists {@link google.cloud.security.privateca.v1.CertificateRevocationList|CertificateRevocationLists}. + * + * @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.security.privateca.v1.CertificateRevocationList|CertificateRevocationLists}, in the format + * `projects/* /locations/* /caPools/* /certificateAuthorities/*`. + * @param {number} [request.pageSize] + * Optional. Limit on the number of + * {@link google.cloud.security.privateca.v1.CertificateRevocationList|CertificateRevocationLists} to include in the + * response. Further {@link google.cloud.security.privateca.v1.CertificateRevocationList|CertificateRevocationLists} + * can subsequently be obtained by including the + * {@link google.cloud.security.privateca.v1.ListCertificateRevocationListsResponse.next_page_token|ListCertificateRevocationListsResponse.next_page_token} in a subsequent + * request. If unspecified, the server will pick an appropriate default. + * @param {string} [request.pageToken] + * Optional. Pagination token, returned earlier via + * {@link google.cloud.security.privateca.v1.ListCertificateRevocationListsResponse.next_page_token|ListCertificateRevocationListsResponse.next_page_token}. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [CertificateRevocationList]{@link google.cloud.security.privateca.v1.CertificateRevocationList}. + * 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 `listCertificateRevocationListsAsync()` + * 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. + */ + listCertificateRevocationLists( + request?: protos.google.cloud.security.privateca.v1.IListCertificateRevocationListsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.security.privateca.v1.ICertificateRevocationList[], + protos.google.cloud.security.privateca.v1.IListCertificateRevocationListsRequest|null, + protos.google.cloud.security.privateca.v1.IListCertificateRevocationListsResponse + ]>; + listCertificateRevocationLists( + request: protos.google.cloud.security.privateca.v1.IListCertificateRevocationListsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.security.privateca.v1.IListCertificateRevocationListsRequest, + protos.google.cloud.security.privateca.v1.IListCertificateRevocationListsResponse|null|undefined, + protos.google.cloud.security.privateca.v1.ICertificateRevocationList>): void; + listCertificateRevocationLists( + request: protos.google.cloud.security.privateca.v1.IListCertificateRevocationListsRequest, + callback: PaginationCallback< + protos.google.cloud.security.privateca.v1.IListCertificateRevocationListsRequest, + protos.google.cloud.security.privateca.v1.IListCertificateRevocationListsResponse|null|undefined, + protos.google.cloud.security.privateca.v1.ICertificateRevocationList>): void; + listCertificateRevocationLists( + request?: protos.google.cloud.security.privateca.v1.IListCertificateRevocationListsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.security.privateca.v1.IListCertificateRevocationListsRequest, + protos.google.cloud.security.privateca.v1.IListCertificateRevocationListsResponse|null|undefined, + protos.google.cloud.security.privateca.v1.ICertificateRevocationList>, + callback?: PaginationCallback< + protos.google.cloud.security.privateca.v1.IListCertificateRevocationListsRequest, + protos.google.cloud.security.privateca.v1.IListCertificateRevocationListsResponse|null|undefined, + protos.google.cloud.security.privateca.v1.ICertificateRevocationList>): + Promise<[ + protos.google.cloud.security.privateca.v1.ICertificateRevocationList[], + protos.google.cloud.security.privateca.v1.IListCertificateRevocationListsRequest|null, + protos.google.cloud.security.privateca.v1.IListCertificateRevocationListsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listCertificateRevocationLists(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.security.privateca.v1.CertificateRevocationList|CertificateRevocationLists}, in the format + * `projects/* /locations/* /caPools/* /certificateAuthorities/*`. + * @param {number} [request.pageSize] + * Optional. Limit on the number of + * {@link google.cloud.security.privateca.v1.CertificateRevocationList|CertificateRevocationLists} to include in the + * response. Further {@link google.cloud.security.privateca.v1.CertificateRevocationList|CertificateRevocationLists} + * can subsequently be obtained by including the + * {@link google.cloud.security.privateca.v1.ListCertificateRevocationListsResponse.next_page_token|ListCertificateRevocationListsResponse.next_page_token} in a subsequent + * request. If unspecified, the server will pick an appropriate default. + * @param {string} [request.pageToken] + * Optional. Pagination token, returned earlier via + * {@link google.cloud.security.privateca.v1.ListCertificateRevocationListsResponse.next_page_token|ListCertificateRevocationListsResponse.next_page_token}. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. + * @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 [CertificateRevocationList]{@link google.cloud.security.privateca.v1.CertificateRevocationList} 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 `listCertificateRevocationListsAsync()` + * 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. + */ + listCertificateRevocationListsStream( + request?: protos.google.cloud.security.privateca.v1.IListCertificateRevocationListsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listCertificateRevocationLists']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listCertificateRevocationLists.createStream( + this.innerApiCalls.listCertificateRevocationLists as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listCertificateRevocationLists`, 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.security.privateca.v1.CertificateRevocationList|CertificateRevocationLists}, in the format + * `projects/* /locations/* /caPools/* /certificateAuthorities/*`. + * @param {number} [request.pageSize] + * Optional. Limit on the number of + * {@link google.cloud.security.privateca.v1.CertificateRevocationList|CertificateRevocationLists} to include in the + * response. Further {@link google.cloud.security.privateca.v1.CertificateRevocationList|CertificateRevocationLists} + * can subsequently be obtained by including the + * {@link google.cloud.security.privateca.v1.ListCertificateRevocationListsResponse.next_page_token|ListCertificateRevocationListsResponse.next_page_token} in a subsequent + * request. If unspecified, the server will pick an appropriate default. + * @param {string} [request.pageToken] + * Optional. Pagination token, returned earlier via + * {@link google.cloud.security.privateca.v1.ListCertificateRevocationListsResponse.next_page_token|ListCertificateRevocationListsResponse.next_page_token}. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. + * @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 + * [CertificateRevocationList]{@link google.cloud.security.privateca.v1.CertificateRevocationList}. 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/certificate_authority_service.list_certificate_revocation_lists.js + * region_tag:privateca_v1_generated_CertificateAuthorityService_ListCertificateRevocationLists_async + */ + listCertificateRevocationListsAsync( + request?: protos.google.cloud.security.privateca.v1.IListCertificateRevocationListsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listCertificateRevocationLists']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listCertificateRevocationLists.asyncIterate( + this.innerApiCalls['listCertificateRevocationLists'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + /** + * Lists {@link google.cloud.security.privateca.v1.CertificateTemplate|CertificateTemplates}. + * + * @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.security.privateca.v1.CertificateTemplate|CertificateTemplates}, in the format + * `projects/* /locations/*`. + * @param {number} [request.pageSize] + * Optional. Limit on the number of + * {@link google.cloud.security.privateca.v1.CertificateTemplate|CertificateTemplates} to include in the response. + * Further {@link google.cloud.security.privateca.v1.CertificateTemplate|CertificateTemplates} can subsequently be + * obtained by including the + * {@link google.cloud.security.privateca.v1.ListCertificateTemplatesResponse.next_page_token|ListCertificateTemplatesResponse.next_page_token} in a subsequent + * request. If unspecified, the server will pick an appropriate default. + * @param {string} [request.pageToken] + * Optional. Pagination token, returned earlier via + * {@link google.cloud.security.privateca.v1.ListCertificateTemplatesResponse.next_page_token|ListCertificateTemplatesResponse.next_page_token}. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [CertificateTemplate]{@link google.cloud.security.privateca.v1.CertificateTemplate}. + * 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 `listCertificateTemplatesAsync()` + * 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. + */ + listCertificateTemplates( + request?: protos.google.cloud.security.privateca.v1.IListCertificateTemplatesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.security.privateca.v1.ICertificateTemplate[], + protos.google.cloud.security.privateca.v1.IListCertificateTemplatesRequest|null, + protos.google.cloud.security.privateca.v1.IListCertificateTemplatesResponse + ]>; + listCertificateTemplates( + request: protos.google.cloud.security.privateca.v1.IListCertificateTemplatesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.security.privateca.v1.IListCertificateTemplatesRequest, + protos.google.cloud.security.privateca.v1.IListCertificateTemplatesResponse|null|undefined, + protos.google.cloud.security.privateca.v1.ICertificateTemplate>): void; + listCertificateTemplates( + request: protos.google.cloud.security.privateca.v1.IListCertificateTemplatesRequest, + callback: PaginationCallback< + protos.google.cloud.security.privateca.v1.IListCertificateTemplatesRequest, + protos.google.cloud.security.privateca.v1.IListCertificateTemplatesResponse|null|undefined, + protos.google.cloud.security.privateca.v1.ICertificateTemplate>): void; + listCertificateTemplates( + request?: protos.google.cloud.security.privateca.v1.IListCertificateTemplatesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.security.privateca.v1.IListCertificateTemplatesRequest, + protos.google.cloud.security.privateca.v1.IListCertificateTemplatesResponse|null|undefined, + protos.google.cloud.security.privateca.v1.ICertificateTemplate>, + callback?: PaginationCallback< + protos.google.cloud.security.privateca.v1.IListCertificateTemplatesRequest, + protos.google.cloud.security.privateca.v1.IListCertificateTemplatesResponse|null|undefined, + protos.google.cloud.security.privateca.v1.ICertificateTemplate>): + Promise<[ + protos.google.cloud.security.privateca.v1.ICertificateTemplate[], + protos.google.cloud.security.privateca.v1.IListCertificateTemplatesRequest|null, + protos.google.cloud.security.privateca.v1.IListCertificateTemplatesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listCertificateTemplates(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.security.privateca.v1.CertificateTemplate|CertificateTemplates}, in the format + * `projects/* /locations/*`. + * @param {number} [request.pageSize] + * Optional. Limit on the number of + * {@link google.cloud.security.privateca.v1.CertificateTemplate|CertificateTemplates} to include in the response. + * Further {@link google.cloud.security.privateca.v1.CertificateTemplate|CertificateTemplates} can subsequently be + * obtained by including the + * {@link google.cloud.security.privateca.v1.ListCertificateTemplatesResponse.next_page_token|ListCertificateTemplatesResponse.next_page_token} in a subsequent + * request. If unspecified, the server will pick an appropriate default. + * @param {string} [request.pageToken] + * Optional. Pagination token, returned earlier via + * {@link google.cloud.security.privateca.v1.ListCertificateTemplatesResponse.next_page_token|ListCertificateTemplatesResponse.next_page_token}. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. + * @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 [CertificateTemplate]{@link google.cloud.security.privateca.v1.CertificateTemplate} 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 `listCertificateTemplatesAsync()` + * 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. + */ + listCertificateTemplatesStream( + request?: protos.google.cloud.security.privateca.v1.IListCertificateTemplatesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listCertificateTemplates']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listCertificateTemplates.createStream( + this.innerApiCalls.listCertificateTemplates as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listCertificateTemplates`, 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.security.privateca.v1.CertificateTemplate|CertificateTemplates}, in the format + * `projects/* /locations/*`. + * @param {number} [request.pageSize] + * Optional. Limit on the number of + * {@link google.cloud.security.privateca.v1.CertificateTemplate|CertificateTemplates} to include in the response. + * Further {@link google.cloud.security.privateca.v1.CertificateTemplate|CertificateTemplates} can subsequently be + * obtained by including the + * {@link google.cloud.security.privateca.v1.ListCertificateTemplatesResponse.next_page_token|ListCertificateTemplatesResponse.next_page_token} in a subsequent + * request. If unspecified, the server will pick an appropriate default. + * @param {string} [request.pageToken] + * Optional. Pagination token, returned earlier via + * {@link google.cloud.security.privateca.v1.ListCertificateTemplatesResponse.next_page_token|ListCertificateTemplatesResponse.next_page_token}. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. + * @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 + * [CertificateTemplate]{@link google.cloud.security.privateca.v1.CertificateTemplate}. 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/certificate_authority_service.list_certificate_templates.js + * region_tag:privateca_v1_generated_CertificateAuthorityService_ListCertificateTemplates_async + */ + listCertificateTemplatesAsync( + request?: protos.google.cloud.security.privateca.v1.IListCertificateTemplatesRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listCertificateTemplates']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listCertificateTemplates.asyncIterate( + this.innerApiCalls['listCertificateTemplates'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } +/** + * Gets the access control policy for a resource. Returns an empty policy + * if the resource exists and does not have a policy set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {Object} [request.options] + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * + * This object should have the same structure as [GetPolicyOptions]{@link google.iam.v1.GetPolicyOptions} + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [Policy]{@link google.iam.v1.Policy}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getIamPolicy( + request: IamProtos.google.iam.v1.GetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise { + return this.iamClient.getIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + setIamPolicy( + request: IamProtos.google.iam.v1.SetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise { + return this.iamClient.setIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + */ + testIamPermissions( + request: IamProtos.google.iam.v1.TestIamPermissionsRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + > + ):Promise { + return this.iamClient.testIamPermissions(request, options, callback); + } + +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified caPool resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} ca_pool + * @returns {string} Resource name string. + */ + caPoolPath(project:string,location:string,caPool:string) { + return this.pathTemplates.caPoolPathTemplate.render({ + project: project, + location: location, + ca_pool: caPool, + }); + } + + /** + * Parse the project from CaPool resource. + * + * @param {string} caPoolName + * A fully-qualified path representing CaPool resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCaPoolName(caPoolName: string) { + return this.pathTemplates.caPoolPathTemplate.match(caPoolName).project; + } + + /** + * Parse the location from CaPool resource. + * + * @param {string} caPoolName + * A fully-qualified path representing CaPool resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCaPoolName(caPoolName: string) { + return this.pathTemplates.caPoolPathTemplate.match(caPoolName).location; + } + + /** + * Parse the ca_pool from CaPool resource. + * + * @param {string} caPoolName + * A fully-qualified path representing CaPool resource. + * @returns {string} A string representing the ca_pool. + */ + matchCaPoolFromCaPoolName(caPoolName: string) { + return this.pathTemplates.caPoolPathTemplate.match(caPoolName).ca_pool; + } + + /** + * Return a fully-qualified certificate resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} ca_pool + * @param {string} certificate + * @returns {string} Resource name string. + */ + certificatePath(project:string,location:string,caPool:string,certificate:string) { + return this.pathTemplates.certificatePathTemplate.render({ + project: project, + location: location, + ca_pool: caPool, + certificate: certificate, + }); + } + + /** + * Parse the project from Certificate resource. + * + * @param {string} certificateName + * A fully-qualified path representing Certificate resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCertificateName(certificateName: string) { + return this.pathTemplates.certificatePathTemplate.match(certificateName).project; + } + + /** + * Parse the location from Certificate resource. + * + * @param {string} certificateName + * A fully-qualified path representing Certificate resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCertificateName(certificateName: string) { + return this.pathTemplates.certificatePathTemplate.match(certificateName).location; + } + + /** + * Parse the ca_pool from Certificate resource. + * + * @param {string} certificateName + * A fully-qualified path representing Certificate resource. + * @returns {string} A string representing the ca_pool. + */ + matchCaPoolFromCertificateName(certificateName: string) { + return this.pathTemplates.certificatePathTemplate.match(certificateName).ca_pool; + } + + /** + * Parse the certificate from Certificate resource. + * + * @param {string} certificateName + * A fully-qualified path representing Certificate resource. + * @returns {string} A string representing the certificate. + */ + matchCertificateFromCertificateName(certificateName: string) { + return this.pathTemplates.certificatePathTemplate.match(certificateName).certificate; + } + + /** + * Return a fully-qualified certificateAuthority resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} ca_pool + * @param {string} certificate_authority + * @returns {string} Resource name string. + */ + certificateAuthorityPath(project:string,location:string,caPool:string,certificateAuthority:string) { + return this.pathTemplates.certificateAuthorityPathTemplate.render({ + project: project, + location: location, + ca_pool: caPool, + certificate_authority: certificateAuthority, + }); + } + + /** + * Parse the project from CertificateAuthority resource. + * + * @param {string} certificateAuthorityName + * A fully-qualified path representing CertificateAuthority resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCertificateAuthorityName(certificateAuthorityName: string) { + return this.pathTemplates.certificateAuthorityPathTemplate.match(certificateAuthorityName).project; + } + + /** + * Parse the location from CertificateAuthority resource. + * + * @param {string} certificateAuthorityName + * A fully-qualified path representing CertificateAuthority resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCertificateAuthorityName(certificateAuthorityName: string) { + return this.pathTemplates.certificateAuthorityPathTemplate.match(certificateAuthorityName).location; + } + + /** + * Parse the ca_pool from CertificateAuthority resource. + * + * @param {string} certificateAuthorityName + * A fully-qualified path representing CertificateAuthority resource. + * @returns {string} A string representing the ca_pool. + */ + matchCaPoolFromCertificateAuthorityName(certificateAuthorityName: string) { + return this.pathTemplates.certificateAuthorityPathTemplate.match(certificateAuthorityName).ca_pool; + } + + /** + * Parse the certificate_authority from CertificateAuthority resource. + * + * @param {string} certificateAuthorityName + * A fully-qualified path representing CertificateAuthority resource. + * @returns {string} A string representing the certificate_authority. + */ + matchCertificateAuthorityFromCertificateAuthorityName(certificateAuthorityName: string) { + return this.pathTemplates.certificateAuthorityPathTemplate.match(certificateAuthorityName).certificate_authority; + } + + /** + * Return a fully-qualified certificateRevocationList resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} ca_pool + * @param {string} certificate_authority + * @param {string} certificate_revocation_list + * @returns {string} Resource name string. + */ + certificateRevocationListPath(project:string,location:string,caPool:string,certificateAuthority:string,certificateRevocationList:string) { + return this.pathTemplates.certificateRevocationListPathTemplate.render({ + project: project, + location: location, + ca_pool: caPool, + certificate_authority: certificateAuthority, + certificate_revocation_list: certificateRevocationList, + }); + } + + /** + * Parse the project from CertificateRevocationList resource. + * + * @param {string} certificateRevocationListName + * A fully-qualified path representing CertificateRevocationList resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCertificateRevocationListName(certificateRevocationListName: string) { + return this.pathTemplates.certificateRevocationListPathTemplate.match(certificateRevocationListName).project; + } + + /** + * Parse the location from CertificateRevocationList resource. + * + * @param {string} certificateRevocationListName + * A fully-qualified path representing CertificateRevocationList resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCertificateRevocationListName(certificateRevocationListName: string) { + return this.pathTemplates.certificateRevocationListPathTemplate.match(certificateRevocationListName).location; + } + + /** + * Parse the ca_pool from CertificateRevocationList resource. + * + * @param {string} certificateRevocationListName + * A fully-qualified path representing CertificateRevocationList resource. + * @returns {string} A string representing the ca_pool. + */ + matchCaPoolFromCertificateRevocationListName(certificateRevocationListName: string) { + return this.pathTemplates.certificateRevocationListPathTemplate.match(certificateRevocationListName).ca_pool; + } + + /** + * Parse the certificate_authority from CertificateRevocationList resource. + * + * @param {string} certificateRevocationListName + * A fully-qualified path representing CertificateRevocationList resource. + * @returns {string} A string representing the certificate_authority. + */ + matchCertificateAuthorityFromCertificateRevocationListName(certificateRevocationListName: string) { + return this.pathTemplates.certificateRevocationListPathTemplate.match(certificateRevocationListName).certificate_authority; + } + + /** + * Parse the certificate_revocation_list from CertificateRevocationList resource. + * + * @param {string} certificateRevocationListName + * A fully-qualified path representing CertificateRevocationList resource. + * @returns {string} A string representing the certificate_revocation_list. + */ + matchCertificateRevocationListFromCertificateRevocationListName(certificateRevocationListName: string) { + return this.pathTemplates.certificateRevocationListPathTemplate.match(certificateRevocationListName).certificate_revocation_list; + } + + /** + * Return a fully-qualified certificateTemplate resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} certificate_template + * @returns {string} Resource name string. + */ + certificateTemplatePath(project:string,location:string,certificateTemplate:string) { + return this.pathTemplates.certificateTemplatePathTemplate.render({ + project: project, + location: location, + certificate_template: certificateTemplate, + }); + } + + /** + * Parse the project from CertificateTemplate resource. + * + * @param {string} certificateTemplateName + * A fully-qualified path representing CertificateTemplate resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCertificateTemplateName(certificateTemplateName: string) { + return this.pathTemplates.certificateTemplatePathTemplate.match(certificateTemplateName).project; + } + + /** + * Parse the location from CertificateTemplate resource. + * + * @param {string} certificateTemplateName + * A fully-qualified path representing CertificateTemplate resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCertificateTemplateName(certificateTemplateName: string) { + return this.pathTemplates.certificateTemplatePathTemplate.match(certificateTemplateName).location; + } + + /** + * Parse the certificate_template from CertificateTemplate resource. + * + * @param {string} certificateTemplateName + * A fully-qualified path representing CertificateTemplate resource. + * @returns {string} A string representing the certificate_template. + */ + matchCertificateTemplateFromCertificateTemplateName(certificateTemplateName: string) { + return this.pathTemplates.certificateTemplatePathTemplate.match(certificateTemplateName).certificate_template; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.certificateAuthorityServiceStub && !this._terminated) { + return this.certificateAuthorityServiceStub.then(stub => { + this._terminated = true; + stub.close(); + this.iamClient.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v1/src/v1/certificate_authority_service_client_config.json b/owl-bot-staging/v1/src/v1/certificate_authority_service_client_config.json new file mode 100644 index 0000000..d7847b0 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/certificate_authority_service_client_config.json @@ -0,0 +1,176 @@ +{ + "interfaces": { + "google.cloud.security.privateca.v1.CertificateAuthorityService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unknown_deadline_exceeded_unavailable": [ + "UNKNOWN", + "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": { + "CreateCertificate": { + "timeout_millis": 60000, + "retry_codes_name": "unknown_deadline_exceeded_unavailable", + "retry_params_name": "default" + }, + "GetCertificate": { + "timeout_millis": 60000, + "retry_codes_name": "unknown_deadline_exceeded_unavailable", + "retry_params_name": "default" + }, + "ListCertificates": { + "timeout_millis": 60000, + "retry_codes_name": "unknown_deadline_exceeded_unavailable", + "retry_params_name": "default" + }, + "RevokeCertificate": { + "timeout_millis": 60000, + "retry_codes_name": "unknown_deadline_exceeded_unavailable", + "retry_params_name": "default" + }, + "UpdateCertificate": { + "timeout_millis": 60000, + "retry_codes_name": "unknown_deadline_exceeded_unavailable", + "retry_params_name": "default" + }, + "ActivateCertificateAuthority": { + "timeout_millis": 60000, + "retry_codes_name": "unknown_deadline_exceeded_unavailable", + "retry_params_name": "default" + }, + "CreateCertificateAuthority": { + "timeout_millis": 60000, + "retry_codes_name": "unknown_deadline_exceeded_unavailable", + "retry_params_name": "default" + }, + "DisableCertificateAuthority": { + "timeout_millis": 60000, + "retry_codes_name": "unknown_deadline_exceeded_unavailable", + "retry_params_name": "default" + }, + "EnableCertificateAuthority": { + "timeout_millis": 60000, + "retry_codes_name": "unknown_deadline_exceeded_unavailable", + "retry_params_name": "default" + }, + "FetchCertificateAuthorityCsr": { + "timeout_millis": 60000, + "retry_codes_name": "unknown_deadline_exceeded_unavailable", + "retry_params_name": "default" + }, + "GetCertificateAuthority": { + "timeout_millis": 60000, + "retry_codes_name": "unknown_deadline_exceeded_unavailable", + "retry_params_name": "default" + }, + "ListCertificateAuthorities": { + "timeout_millis": 60000, + "retry_codes_name": "unknown_deadline_exceeded_unavailable", + "retry_params_name": "default" + }, + "UndeleteCertificateAuthority": { + "timeout_millis": 60000, + "retry_codes_name": "unknown_deadline_exceeded_unavailable", + "retry_params_name": "default" + }, + "DeleteCertificateAuthority": { + "timeout_millis": 60000, + "retry_codes_name": "unknown_deadline_exceeded_unavailable", + "retry_params_name": "default" + }, + "UpdateCertificateAuthority": { + "timeout_millis": 60000, + "retry_codes_name": "unknown_deadline_exceeded_unavailable", + "retry_params_name": "default" + }, + "CreateCaPool": { + "timeout_millis": 60000, + "retry_codes_name": "unknown_deadline_exceeded_unavailable", + "retry_params_name": "default" + }, + "UpdateCaPool": { + "timeout_millis": 60000, + "retry_codes_name": "unknown_deadline_exceeded_unavailable", + "retry_params_name": "default" + }, + "GetCaPool": { + "timeout_millis": 60000, + "retry_codes_name": "unknown_deadline_exceeded_unavailable", + "retry_params_name": "default" + }, + "ListCaPools": { + "timeout_millis": 60000, + "retry_codes_name": "unknown_deadline_exceeded_unavailable", + "retry_params_name": "default" + }, + "DeleteCaPool": { + "timeout_millis": 60000, + "retry_codes_name": "unknown_deadline_exceeded_unavailable", + "retry_params_name": "default" + }, + "FetchCaCerts": { + "timeout_millis": 60000, + "retry_codes_name": "unknown_deadline_exceeded_unavailable", + "retry_params_name": "default" + }, + "GetCertificateRevocationList": { + "timeout_millis": 60000, + "retry_codes_name": "unknown_deadline_exceeded_unavailable", + "retry_params_name": "default" + }, + "ListCertificateRevocationLists": { + "timeout_millis": 60000, + "retry_codes_name": "unknown_deadline_exceeded_unavailable", + "retry_params_name": "default" + }, + "UpdateCertificateRevocationList": { + "timeout_millis": 60000, + "retry_codes_name": "unknown_deadline_exceeded_unavailable", + "retry_params_name": "default" + }, + "CreateCertificateTemplate": { + "timeout_millis": 60000, + "retry_codes_name": "unknown_deadline_exceeded_unavailable", + "retry_params_name": "default" + }, + "DeleteCertificateTemplate": { + "timeout_millis": 60000, + "retry_codes_name": "unknown_deadline_exceeded_unavailable", + "retry_params_name": "default" + }, + "GetCertificateTemplate": { + "timeout_millis": 60000, + "retry_codes_name": "unknown_deadline_exceeded_unavailable", + "retry_params_name": "default" + }, + "ListCertificateTemplates": { + "timeout_millis": 60000, + "retry_codes_name": "unknown_deadline_exceeded_unavailable", + "retry_params_name": "default" + }, + "UpdateCertificateTemplate": { + "timeout_millis": 60000, + "retry_codes_name": "unknown_deadline_exceeded_unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v1/src/v1/certificate_authority_service_proto_list.json b/owl-bot-staging/v1/src/v1/certificate_authority_service_proto_list.json new file mode 100644 index 0000000..ec340e4 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/certificate_authority_service_proto_list.json @@ -0,0 +1,4 @@ +[ + "../../protos/google/cloud/security/privateca/v1/resources.proto", + "../../protos/google/cloud/security/privateca/v1/service.proto" +] diff --git a/owl-bot-staging/v1/src/v1/gapic_metadata.json b/owl-bot-staging/v1/src/v1/gapic_metadata.json new file mode 100644 index 0000000..dc371ea --- /dev/null +++ b/owl-bot-staging/v1/src/v1/gapic_metadata.json @@ -0,0 +1,333 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.security.privateca.v1", + "libraryPackage": "@google-cloud/security-private-ca", + "services": { + "CertificateAuthorityService": { + "clients": { + "grpc": { + "libraryClient": "CertificateAuthorityServiceClient", + "rpcs": { + "CreateCertificate": { + "methods": [ + "createCertificate" + ] + }, + "GetCertificate": { + "methods": [ + "getCertificate" + ] + }, + "RevokeCertificate": { + "methods": [ + "revokeCertificate" + ] + }, + "UpdateCertificate": { + "methods": [ + "updateCertificate" + ] + }, + "FetchCertificateAuthorityCsr": { + "methods": [ + "fetchCertificateAuthorityCsr" + ] + }, + "GetCertificateAuthority": { + "methods": [ + "getCertificateAuthority" + ] + }, + "GetCaPool": { + "methods": [ + "getCaPool" + ] + }, + "FetchCaCerts": { + "methods": [ + "fetchCaCerts" + ] + }, + "GetCertificateRevocationList": { + "methods": [ + "getCertificateRevocationList" + ] + }, + "GetCertificateTemplate": { + "methods": [ + "getCertificateTemplate" + ] + }, + "ActivateCertificateAuthority": { + "methods": [ + "activateCertificateAuthority" + ] + }, + "CreateCertificateAuthority": { + "methods": [ + "createCertificateAuthority" + ] + }, + "DisableCertificateAuthority": { + "methods": [ + "disableCertificateAuthority" + ] + }, + "EnableCertificateAuthority": { + "methods": [ + "enableCertificateAuthority" + ] + }, + "UndeleteCertificateAuthority": { + "methods": [ + "undeleteCertificateAuthority" + ] + }, + "DeleteCertificateAuthority": { + "methods": [ + "deleteCertificateAuthority" + ] + }, + "UpdateCertificateAuthority": { + "methods": [ + "updateCertificateAuthority" + ] + }, + "CreateCaPool": { + "methods": [ + "createCaPool" + ] + }, + "UpdateCaPool": { + "methods": [ + "updateCaPool" + ] + }, + "DeleteCaPool": { + "methods": [ + "deleteCaPool" + ] + }, + "UpdateCertificateRevocationList": { + "methods": [ + "updateCertificateRevocationList" + ] + }, + "CreateCertificateTemplate": { + "methods": [ + "createCertificateTemplate" + ] + }, + "DeleteCertificateTemplate": { + "methods": [ + "deleteCertificateTemplate" + ] + }, + "UpdateCertificateTemplate": { + "methods": [ + "updateCertificateTemplate" + ] + }, + "ListCertificates": { + "methods": [ + "listCertificates", + "listCertificatesStream", + "listCertificatesAsync" + ] + }, + "ListCertificateAuthorities": { + "methods": [ + "listCertificateAuthorities", + "listCertificateAuthoritiesStream", + "listCertificateAuthoritiesAsync" + ] + }, + "ListCaPools": { + "methods": [ + "listCaPools", + "listCaPoolsStream", + "listCaPoolsAsync" + ] + }, + "ListCertificateRevocationLists": { + "methods": [ + "listCertificateRevocationLists", + "listCertificateRevocationListsStream", + "listCertificateRevocationListsAsync" + ] + }, + "ListCertificateTemplates": { + "methods": [ + "listCertificateTemplates", + "listCertificateTemplatesStream", + "listCertificateTemplatesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "CertificateAuthorityServiceClient", + "rpcs": { + "CreateCertificate": { + "methods": [ + "createCertificate" + ] + }, + "GetCertificate": { + "methods": [ + "getCertificate" + ] + }, + "RevokeCertificate": { + "methods": [ + "revokeCertificate" + ] + }, + "UpdateCertificate": { + "methods": [ + "updateCertificate" + ] + }, + "FetchCertificateAuthorityCsr": { + "methods": [ + "fetchCertificateAuthorityCsr" + ] + }, + "GetCertificateAuthority": { + "methods": [ + "getCertificateAuthority" + ] + }, + "GetCaPool": { + "methods": [ + "getCaPool" + ] + }, + "FetchCaCerts": { + "methods": [ + "fetchCaCerts" + ] + }, + "GetCertificateRevocationList": { + "methods": [ + "getCertificateRevocationList" + ] + }, + "GetCertificateTemplate": { + "methods": [ + "getCertificateTemplate" + ] + }, + "ActivateCertificateAuthority": { + "methods": [ + "activateCertificateAuthority" + ] + }, + "CreateCertificateAuthority": { + "methods": [ + "createCertificateAuthority" + ] + }, + "DisableCertificateAuthority": { + "methods": [ + "disableCertificateAuthority" + ] + }, + "EnableCertificateAuthority": { + "methods": [ + "enableCertificateAuthority" + ] + }, + "UndeleteCertificateAuthority": { + "methods": [ + "undeleteCertificateAuthority" + ] + }, + "DeleteCertificateAuthority": { + "methods": [ + "deleteCertificateAuthority" + ] + }, + "UpdateCertificateAuthority": { + "methods": [ + "updateCertificateAuthority" + ] + }, + "CreateCaPool": { + "methods": [ + "createCaPool" + ] + }, + "UpdateCaPool": { + "methods": [ + "updateCaPool" + ] + }, + "DeleteCaPool": { + "methods": [ + "deleteCaPool" + ] + }, + "UpdateCertificateRevocationList": { + "methods": [ + "updateCertificateRevocationList" + ] + }, + "CreateCertificateTemplate": { + "methods": [ + "createCertificateTemplate" + ] + }, + "DeleteCertificateTemplate": { + "methods": [ + "deleteCertificateTemplate" + ] + }, + "UpdateCertificateTemplate": { + "methods": [ + "updateCertificateTemplate" + ] + }, + "ListCertificates": { + "methods": [ + "listCertificates", + "listCertificatesStream", + "listCertificatesAsync" + ] + }, + "ListCertificateAuthorities": { + "methods": [ + "listCertificateAuthorities", + "listCertificateAuthoritiesStream", + "listCertificateAuthoritiesAsync" + ] + }, + "ListCaPools": { + "methods": [ + "listCaPools", + "listCaPoolsStream", + "listCaPoolsAsync" + ] + }, + "ListCertificateRevocationLists": { + "methods": [ + "listCertificateRevocationLists", + "listCertificateRevocationListsStream", + "listCertificateRevocationListsAsync" + ] + }, + "ListCertificateTemplates": { + "methods": [ + "listCertificateTemplates", + "listCertificateTemplatesStream", + "listCertificateTemplatesAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/v1/src/v1/index.ts b/owl-bot-staging/v1/src/v1/index.ts new file mode 100644 index 0000000..846c95b --- /dev/null +++ b/owl-bot-staging/v1/src/v1/index.ts @@ -0,0 +1,19 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +export {CertificateAuthorityServiceClient} from './certificate_authority_service_client'; diff --git a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 0000000..8d0d0f8 --- /dev/null +++ b/owl-bot-staging/v1/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 privateca = require('@google-cloud/security-private-ca'); + +function main() { + const certificateAuthorityServiceClient = new privateca.CertificateAuthorityServiceClient(); +} + +main(); diff --git a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 0000000..445ab31 --- /dev/null +++ b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,32 @@ +// 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 {CertificateAuthorityServiceClient} from '@google-cloud/security-private-ca'; + +// check that the client class type name can be used +function doStuffWithCertificateAuthorityServiceClient(client: CertificateAuthorityServiceClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const certificateAuthorityServiceClient = new CertificateAuthorityServiceClient(); + doStuffWithCertificateAuthorityServiceClient(certificateAuthorityServiceClient); +} + +main(); diff --git a/owl-bot-staging/v1/system-test/install.ts b/owl-bot-staging/v1/system-test/install.ts new file mode 100644 index 0000000..8ec4522 --- /dev/null +++ b/owl-bot-staging/v1/system-test/install.ts @@ -0,0 +1,49 @@ +// 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/owl-bot-staging/v1/test/gapic_certificate_authority_service_v1.ts b/owl-bot-staging/v1/test/gapic_certificate_authority_service_v1.ts new file mode 100644 index 0000000..7158747 --- /dev/null +++ b/owl-bot-staging/v1/test/gapic_certificate_authority_service_v1.ts @@ -0,0 +1,5062 @@ +// 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 certificateauthorityserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.CertificateAuthorityServiceClient', () => { + it('has servicePath', () => { + const servicePath = certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.certificateAuthorityServiceStub, undefined); + await client.initialize(); + assert(client.certificateAuthorityServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.certificateAuthorityServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.certificateAuthorityServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + 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 certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + 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('createCertificate', () => { + it('invokes createCertificate without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.CreateCertificateRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1.Certificate()); + client.innerApiCalls.createCertificate = stubSimpleCall(expectedResponse); + const [response] = await client.createCertificate(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createCertificate as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createCertificate without error using callback', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.CreateCertificateRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1.Certificate()); + client.innerApiCalls.createCertificate = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createCertificate( + request, + (err?: Error|null, result?: protos.google.cloud.security.privateca.v1.ICertificate|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createCertificate as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createCertificate with error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.CreateCertificateRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createCertificate = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createCertificate(request), expectedError); + assert((client.innerApiCalls.createCertificate as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createCertificate with closed client', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.CreateCertificateRequest()); + request.parent = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createCertificate(request), expectedError); + }); + }); + + describe('getCertificate', () => { + it('invokes getCertificate without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.GetCertificateRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1.Certificate()); + client.innerApiCalls.getCertificate = stubSimpleCall(expectedResponse); + const [response] = await client.getCertificate(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getCertificate as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getCertificate without error using callback', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.GetCertificateRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1.Certificate()); + client.innerApiCalls.getCertificate = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getCertificate( + request, + (err?: Error|null, result?: protos.google.cloud.security.privateca.v1.ICertificate|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getCertificate as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getCertificate with error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.GetCertificateRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getCertificate = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getCertificate(request), expectedError); + assert((client.innerApiCalls.getCertificate as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getCertificate with closed client', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.GetCertificateRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getCertificate(request), expectedError); + }); + }); + + describe('revokeCertificate', () => { + it('invokes revokeCertificate without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.RevokeCertificateRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1.Certificate()); + client.innerApiCalls.revokeCertificate = stubSimpleCall(expectedResponse); + const [response] = await client.revokeCertificate(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.revokeCertificate as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes revokeCertificate without error using callback', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.RevokeCertificateRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1.Certificate()); + client.innerApiCalls.revokeCertificate = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.revokeCertificate( + request, + (err?: Error|null, result?: protos.google.cloud.security.privateca.v1.ICertificate|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.revokeCertificate as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes revokeCertificate with error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.RevokeCertificateRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.revokeCertificate = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.revokeCertificate(request), expectedError); + assert((client.innerApiCalls.revokeCertificate as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes revokeCertificate with closed client', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.RevokeCertificateRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.revokeCertificate(request), expectedError); + }); + }); + + describe('updateCertificate', () => { + it('invokes updateCertificate without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.UpdateCertificateRequest()); + request.certificate = {}; + request.certificate.name = ''; + const expectedHeaderRequestParams = "certificate.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1.Certificate()); + client.innerApiCalls.updateCertificate = stubSimpleCall(expectedResponse); + const [response] = await client.updateCertificate(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateCertificate as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateCertificate without error using callback', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.UpdateCertificateRequest()); + request.certificate = {}; + request.certificate.name = ''; + const expectedHeaderRequestParams = "certificate.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1.Certificate()); + client.innerApiCalls.updateCertificate = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateCertificate( + request, + (err?: Error|null, result?: protos.google.cloud.security.privateca.v1.ICertificate|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateCertificate as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateCertificate with error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.UpdateCertificateRequest()); + request.certificate = {}; + request.certificate.name = ''; + const expectedHeaderRequestParams = "certificate.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateCertificate = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateCertificate(request), expectedError); + assert((client.innerApiCalls.updateCertificate as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateCertificate with closed client', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.UpdateCertificateRequest()); + request.certificate = {}; + request.certificate.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateCertificate(request), expectedError); + }); + }); + + describe('fetchCertificateAuthorityCsr', () => { + it('invokes fetchCertificateAuthorityCsr without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.FetchCertificateAuthorityCsrRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1.FetchCertificateAuthorityCsrResponse()); + client.innerApiCalls.fetchCertificateAuthorityCsr = stubSimpleCall(expectedResponse); + const [response] = await client.fetchCertificateAuthorityCsr(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.fetchCertificateAuthorityCsr as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes fetchCertificateAuthorityCsr without error using callback', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.FetchCertificateAuthorityCsrRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1.FetchCertificateAuthorityCsrResponse()); + client.innerApiCalls.fetchCertificateAuthorityCsr = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.fetchCertificateAuthorityCsr( + request, + (err?: Error|null, result?: protos.google.cloud.security.privateca.v1.IFetchCertificateAuthorityCsrResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.fetchCertificateAuthorityCsr as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes fetchCertificateAuthorityCsr with error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.FetchCertificateAuthorityCsrRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.fetchCertificateAuthorityCsr = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.fetchCertificateAuthorityCsr(request), expectedError); + assert((client.innerApiCalls.fetchCertificateAuthorityCsr as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes fetchCertificateAuthorityCsr with closed client', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.FetchCertificateAuthorityCsrRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.fetchCertificateAuthorityCsr(request), expectedError); + }); + }); + + describe('getCertificateAuthority', () => { + it('invokes getCertificateAuthority without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.GetCertificateAuthorityRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateAuthority()); + client.innerApiCalls.getCertificateAuthority = stubSimpleCall(expectedResponse); + const [response] = await client.getCertificateAuthority(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getCertificateAuthority without error using callback', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.GetCertificateAuthorityRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateAuthority()); + client.innerApiCalls.getCertificateAuthority = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getCertificateAuthority( + request, + (err?: Error|null, result?: protos.google.cloud.security.privateca.v1.ICertificateAuthority|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getCertificateAuthority with error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.GetCertificateAuthorityRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getCertificateAuthority = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getCertificateAuthority(request), expectedError); + assert((client.innerApiCalls.getCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getCertificateAuthority with closed client', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.GetCertificateAuthorityRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getCertificateAuthority(request), expectedError); + }); + }); + + describe('getCaPool', () => { + it('invokes getCaPool without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.GetCaPoolRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1.CaPool()); + client.innerApiCalls.getCaPool = stubSimpleCall(expectedResponse); + const [response] = await client.getCaPool(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getCaPool as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getCaPool without error using callback', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.GetCaPoolRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1.CaPool()); + client.innerApiCalls.getCaPool = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getCaPool( + request, + (err?: Error|null, result?: protos.google.cloud.security.privateca.v1.ICaPool|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getCaPool as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getCaPool with error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.GetCaPoolRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getCaPool = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getCaPool(request), expectedError); + assert((client.innerApiCalls.getCaPool as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getCaPool with closed client', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.GetCaPoolRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getCaPool(request), expectedError); + }); + }); + + describe('fetchCaCerts', () => { + it('invokes fetchCaCerts without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.FetchCaCertsRequest()); + request.caPool = ''; + const expectedHeaderRequestParams = "ca_pool="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1.FetchCaCertsResponse()); + client.innerApiCalls.fetchCaCerts = stubSimpleCall(expectedResponse); + const [response] = await client.fetchCaCerts(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.fetchCaCerts as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes fetchCaCerts without error using callback', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.FetchCaCertsRequest()); + request.caPool = ''; + const expectedHeaderRequestParams = "ca_pool="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1.FetchCaCertsResponse()); + client.innerApiCalls.fetchCaCerts = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.fetchCaCerts( + request, + (err?: Error|null, result?: protos.google.cloud.security.privateca.v1.IFetchCaCertsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.fetchCaCerts as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes fetchCaCerts with error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.FetchCaCertsRequest()); + request.caPool = ''; + const expectedHeaderRequestParams = "ca_pool="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.fetchCaCerts = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.fetchCaCerts(request), expectedError); + assert((client.innerApiCalls.fetchCaCerts as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes fetchCaCerts with closed client', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.FetchCaCertsRequest()); + request.caPool = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.fetchCaCerts(request), expectedError); + }); + }); + + describe('getCertificateRevocationList', () => { + it('invokes getCertificateRevocationList without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.GetCertificateRevocationListRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateRevocationList()); + client.innerApiCalls.getCertificateRevocationList = stubSimpleCall(expectedResponse); + const [response] = await client.getCertificateRevocationList(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getCertificateRevocationList as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getCertificateRevocationList without error using callback', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.GetCertificateRevocationListRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateRevocationList()); + client.innerApiCalls.getCertificateRevocationList = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getCertificateRevocationList( + request, + (err?: Error|null, result?: protos.google.cloud.security.privateca.v1.ICertificateRevocationList|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getCertificateRevocationList as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getCertificateRevocationList with error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.GetCertificateRevocationListRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getCertificateRevocationList = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getCertificateRevocationList(request), expectedError); + assert((client.innerApiCalls.getCertificateRevocationList as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getCertificateRevocationList with closed client', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.GetCertificateRevocationListRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getCertificateRevocationList(request), expectedError); + }); + }); + + describe('getCertificateTemplate', () => { + it('invokes getCertificateTemplate without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.GetCertificateTemplateRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateTemplate()); + client.innerApiCalls.getCertificateTemplate = stubSimpleCall(expectedResponse); + const [response] = await client.getCertificateTemplate(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getCertificateTemplate as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getCertificateTemplate without error using callback', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.GetCertificateTemplateRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateTemplate()); + client.innerApiCalls.getCertificateTemplate = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getCertificateTemplate( + request, + (err?: Error|null, result?: protos.google.cloud.security.privateca.v1.ICertificateTemplate|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getCertificateTemplate as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getCertificateTemplate with error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.GetCertificateTemplateRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getCertificateTemplate = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getCertificateTemplate(request), expectedError); + assert((client.innerApiCalls.getCertificateTemplate as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getCertificateTemplate with closed client', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.GetCertificateTemplateRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getCertificateTemplate(request), expectedError); + }); + }); + + describe('activateCertificateAuthority', () => { + it('invokes activateCertificateAuthority without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ActivateCertificateAuthorityRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.activateCertificateAuthority = stubLongRunningCall(expectedResponse); + const [operation] = await client.activateCertificateAuthority(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.activateCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes activateCertificateAuthority without error using callback', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ActivateCertificateAuthorityRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.activateCertificateAuthority = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.activateCertificateAuthority( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.activateCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes activateCertificateAuthority with call error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ActivateCertificateAuthorityRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.activateCertificateAuthority = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.activateCertificateAuthority(request), expectedError); + assert((client.innerApiCalls.activateCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes activateCertificateAuthority with LRO error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ActivateCertificateAuthorityRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.activateCertificateAuthority = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.activateCertificateAuthority(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.activateCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkActivateCertificateAuthorityProgress without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkActivateCertificateAuthorityProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkActivateCertificateAuthorityProgress with error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkActivateCertificateAuthorityProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createCertificateAuthority', () => { + it('invokes createCertificateAuthority without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.CreateCertificateAuthorityRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createCertificateAuthority = stubLongRunningCall(expectedResponse); + const [operation] = await client.createCertificateAuthority(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createCertificateAuthority without error using callback', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.CreateCertificateAuthorityRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createCertificateAuthority = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createCertificateAuthority( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createCertificateAuthority with call error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.CreateCertificateAuthorityRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createCertificateAuthority = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createCertificateAuthority(request), expectedError); + assert((client.innerApiCalls.createCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createCertificateAuthority with LRO error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.CreateCertificateAuthorityRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createCertificateAuthority = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createCertificateAuthority(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.createCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkCreateCertificateAuthorityProgress without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateCertificateAuthorityProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateCertificateAuthorityProgress with error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateCertificateAuthorityProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('disableCertificateAuthority', () => { + it('invokes disableCertificateAuthority without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.DisableCertificateAuthorityRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.disableCertificateAuthority = stubLongRunningCall(expectedResponse); + const [operation] = await client.disableCertificateAuthority(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.disableCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes disableCertificateAuthority without error using callback', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.DisableCertificateAuthorityRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.disableCertificateAuthority = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.disableCertificateAuthority( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.disableCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes disableCertificateAuthority with call error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.DisableCertificateAuthorityRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.disableCertificateAuthority = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.disableCertificateAuthority(request), expectedError); + assert((client.innerApiCalls.disableCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes disableCertificateAuthority with LRO error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.DisableCertificateAuthorityRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.disableCertificateAuthority = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.disableCertificateAuthority(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.disableCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkDisableCertificateAuthorityProgress without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDisableCertificateAuthorityProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDisableCertificateAuthorityProgress with error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDisableCertificateAuthorityProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('enableCertificateAuthority', () => { + it('invokes enableCertificateAuthority without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.EnableCertificateAuthorityRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.enableCertificateAuthority = stubLongRunningCall(expectedResponse); + const [operation] = await client.enableCertificateAuthority(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.enableCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes enableCertificateAuthority without error using callback', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.EnableCertificateAuthorityRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.enableCertificateAuthority = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.enableCertificateAuthority( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.enableCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes enableCertificateAuthority with call error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.EnableCertificateAuthorityRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.enableCertificateAuthority = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.enableCertificateAuthority(request), expectedError); + assert((client.innerApiCalls.enableCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes enableCertificateAuthority with LRO error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.EnableCertificateAuthorityRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.enableCertificateAuthority = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.enableCertificateAuthority(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.enableCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkEnableCertificateAuthorityProgress without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkEnableCertificateAuthorityProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkEnableCertificateAuthorityProgress with error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkEnableCertificateAuthorityProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('undeleteCertificateAuthority', () => { + it('invokes undeleteCertificateAuthority without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.UndeleteCertificateAuthorityRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.undeleteCertificateAuthority = stubLongRunningCall(expectedResponse); + const [operation] = await client.undeleteCertificateAuthority(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.undeleteCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes undeleteCertificateAuthority without error using callback', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.UndeleteCertificateAuthorityRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.undeleteCertificateAuthority = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.undeleteCertificateAuthority( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.undeleteCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes undeleteCertificateAuthority with call error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.UndeleteCertificateAuthorityRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.undeleteCertificateAuthority = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.undeleteCertificateAuthority(request), expectedError); + assert((client.innerApiCalls.undeleteCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes undeleteCertificateAuthority with LRO error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.UndeleteCertificateAuthorityRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.undeleteCertificateAuthority = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.undeleteCertificateAuthority(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.undeleteCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkUndeleteCertificateAuthorityProgress without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUndeleteCertificateAuthorityProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUndeleteCertificateAuthorityProgress with error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUndeleteCertificateAuthorityProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteCertificateAuthority', () => { + it('invokes deleteCertificateAuthority without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.DeleteCertificateAuthorityRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.deleteCertificateAuthority = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteCertificateAuthority(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteCertificateAuthority without error using callback', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.DeleteCertificateAuthorityRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.deleteCertificateAuthority = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteCertificateAuthority( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteCertificateAuthority with call error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.DeleteCertificateAuthorityRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteCertificateAuthority = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteCertificateAuthority(request), expectedError); + assert((client.innerApiCalls.deleteCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteCertificateAuthority with LRO error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.DeleteCertificateAuthorityRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteCertificateAuthority = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteCertificateAuthority(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.deleteCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkDeleteCertificateAuthorityProgress without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteCertificateAuthorityProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteCertificateAuthorityProgress with error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteCertificateAuthorityProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateCertificateAuthority', () => { + it('invokes updateCertificateAuthority without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.UpdateCertificateAuthorityRequest()); + request.certificateAuthority = {}; + request.certificateAuthority.name = ''; + const expectedHeaderRequestParams = "certificate_authority.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.updateCertificateAuthority = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateCertificateAuthority(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateCertificateAuthority without error using callback', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.UpdateCertificateAuthorityRequest()); + request.certificateAuthority = {}; + request.certificateAuthority.name = ''; + const expectedHeaderRequestParams = "certificate_authority.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.updateCertificateAuthority = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateCertificateAuthority( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateCertificateAuthority with call error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.UpdateCertificateAuthorityRequest()); + request.certificateAuthority = {}; + request.certificateAuthority.name = ''; + const expectedHeaderRequestParams = "certificate_authority.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateCertificateAuthority = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateCertificateAuthority(request), expectedError); + assert((client.innerApiCalls.updateCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateCertificateAuthority with LRO error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.UpdateCertificateAuthorityRequest()); + request.certificateAuthority = {}; + request.certificateAuthority.name = ''; + const expectedHeaderRequestParams = "certificate_authority.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateCertificateAuthority = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateCertificateAuthority(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.updateCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkUpdateCertificateAuthorityProgress without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateCertificateAuthorityProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateCertificateAuthorityProgress with error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateCertificateAuthorityProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createCaPool', () => { + it('invokes createCaPool without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.CreateCaPoolRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createCaPool = stubLongRunningCall(expectedResponse); + const [operation] = await client.createCaPool(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createCaPool as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createCaPool without error using callback', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.CreateCaPoolRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createCaPool = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createCaPool( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createCaPool as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createCaPool with call error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.CreateCaPoolRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createCaPool = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createCaPool(request), expectedError); + assert((client.innerApiCalls.createCaPool as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createCaPool with LRO error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.CreateCaPoolRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createCaPool = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createCaPool(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.createCaPool as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkCreateCaPoolProgress without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateCaPoolProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateCaPoolProgress with error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateCaPoolProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateCaPool', () => { + it('invokes updateCaPool without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.UpdateCaPoolRequest()); + request.caPool = {}; + request.caPool.name = ''; + const expectedHeaderRequestParams = "ca_pool.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.updateCaPool = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateCaPool(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateCaPool as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateCaPool without error using callback', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.UpdateCaPoolRequest()); + request.caPool = {}; + request.caPool.name = ''; + const expectedHeaderRequestParams = "ca_pool.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.updateCaPool = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateCaPool( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateCaPool as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateCaPool with call error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.UpdateCaPoolRequest()); + request.caPool = {}; + request.caPool.name = ''; + const expectedHeaderRequestParams = "ca_pool.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateCaPool = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateCaPool(request), expectedError); + assert((client.innerApiCalls.updateCaPool as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateCaPool with LRO error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.UpdateCaPoolRequest()); + request.caPool = {}; + request.caPool.name = ''; + const expectedHeaderRequestParams = "ca_pool.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateCaPool = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateCaPool(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.updateCaPool as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkUpdateCaPoolProgress without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateCaPoolProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateCaPoolProgress with error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateCaPoolProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteCaPool', () => { + it('invokes deleteCaPool without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.DeleteCaPoolRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.deleteCaPool = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteCaPool(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteCaPool as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteCaPool without error using callback', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.DeleteCaPoolRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.deleteCaPool = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteCaPool( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteCaPool as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteCaPool with call error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.DeleteCaPoolRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteCaPool = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteCaPool(request), expectedError); + assert((client.innerApiCalls.deleteCaPool as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteCaPool with LRO error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.DeleteCaPoolRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteCaPool = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteCaPool(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.deleteCaPool as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkDeleteCaPoolProgress without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteCaPoolProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteCaPoolProgress with error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteCaPoolProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateCertificateRevocationList', () => { + it('invokes updateCertificateRevocationList without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.UpdateCertificateRevocationListRequest()); + request.certificateRevocationList = {}; + request.certificateRevocationList.name = ''; + const expectedHeaderRequestParams = "certificate_revocation_list.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.updateCertificateRevocationList = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateCertificateRevocationList(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateCertificateRevocationList as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateCertificateRevocationList without error using callback', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.UpdateCertificateRevocationListRequest()); + request.certificateRevocationList = {}; + request.certificateRevocationList.name = ''; + const expectedHeaderRequestParams = "certificate_revocation_list.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.updateCertificateRevocationList = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateCertificateRevocationList( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateCertificateRevocationList as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateCertificateRevocationList with call error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.UpdateCertificateRevocationListRequest()); + request.certificateRevocationList = {}; + request.certificateRevocationList.name = ''; + const expectedHeaderRequestParams = "certificate_revocation_list.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateCertificateRevocationList = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateCertificateRevocationList(request), expectedError); + assert((client.innerApiCalls.updateCertificateRevocationList as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateCertificateRevocationList with LRO error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.UpdateCertificateRevocationListRequest()); + request.certificateRevocationList = {}; + request.certificateRevocationList.name = ''; + const expectedHeaderRequestParams = "certificate_revocation_list.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateCertificateRevocationList = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateCertificateRevocationList(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.updateCertificateRevocationList as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkUpdateCertificateRevocationListProgress without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateCertificateRevocationListProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateCertificateRevocationListProgress with error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateCertificateRevocationListProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createCertificateTemplate', () => { + it('invokes createCertificateTemplate without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.CreateCertificateTemplateRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createCertificateTemplate = stubLongRunningCall(expectedResponse); + const [operation] = await client.createCertificateTemplate(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createCertificateTemplate as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createCertificateTemplate without error using callback', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.CreateCertificateTemplateRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createCertificateTemplate = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createCertificateTemplate( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createCertificateTemplate as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createCertificateTemplate with call error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.CreateCertificateTemplateRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createCertificateTemplate = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createCertificateTemplate(request), expectedError); + assert((client.innerApiCalls.createCertificateTemplate as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createCertificateTemplate with LRO error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.CreateCertificateTemplateRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createCertificateTemplate = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createCertificateTemplate(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.createCertificateTemplate as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkCreateCertificateTemplateProgress without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateCertificateTemplateProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateCertificateTemplateProgress with error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateCertificateTemplateProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteCertificateTemplate', () => { + it('invokes deleteCertificateTemplate without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.DeleteCertificateTemplateRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.deleteCertificateTemplate = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteCertificateTemplate(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteCertificateTemplate as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteCertificateTemplate without error using callback', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.DeleteCertificateTemplateRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.deleteCertificateTemplate = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteCertificateTemplate( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteCertificateTemplate as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteCertificateTemplate with call error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.DeleteCertificateTemplateRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteCertificateTemplate = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteCertificateTemplate(request), expectedError); + assert((client.innerApiCalls.deleteCertificateTemplate as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteCertificateTemplate with LRO error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.DeleteCertificateTemplateRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteCertificateTemplate = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteCertificateTemplate(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.deleteCertificateTemplate as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkDeleteCertificateTemplateProgress without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteCertificateTemplateProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteCertificateTemplateProgress with error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteCertificateTemplateProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateCertificateTemplate', () => { + it('invokes updateCertificateTemplate without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.UpdateCertificateTemplateRequest()); + request.certificateTemplate = {}; + request.certificateTemplate.name = ''; + const expectedHeaderRequestParams = "certificate_template.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.updateCertificateTemplate = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateCertificateTemplate(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateCertificateTemplate as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateCertificateTemplate without error using callback', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.UpdateCertificateTemplateRequest()); + request.certificateTemplate = {}; + request.certificateTemplate.name = ''; + const expectedHeaderRequestParams = "certificate_template.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.updateCertificateTemplate = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateCertificateTemplate( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateCertificateTemplate as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateCertificateTemplate with call error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.UpdateCertificateTemplateRequest()); + request.certificateTemplate = {}; + request.certificateTemplate.name = ''; + const expectedHeaderRequestParams = "certificate_template.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateCertificateTemplate = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateCertificateTemplate(request), expectedError); + assert((client.innerApiCalls.updateCertificateTemplate as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateCertificateTemplate with LRO error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.UpdateCertificateTemplateRequest()); + request.certificateTemplate = {}; + request.certificateTemplate.name = ''; + const expectedHeaderRequestParams = "certificate_template.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateCertificateTemplate = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateCertificateTemplate(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.updateCertificateTemplate as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkUpdateCertificateTemplateProgress without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateCertificateTemplateProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateCertificateTemplateProgress with error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateCertificateTemplateProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listCertificates', () => { + it('invokes listCertificates without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificatesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.security.privateca.v1.Certificate()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1.Certificate()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1.Certificate()), + ]; + client.innerApiCalls.listCertificates = stubSimpleCall(expectedResponse); + const [response] = await client.listCertificates(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listCertificates as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listCertificates without error using callback', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificatesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.security.privateca.v1.Certificate()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1.Certificate()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1.Certificate()), + ]; + client.innerApiCalls.listCertificates = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listCertificates( + request, + (err?: Error|null, result?: protos.google.cloud.security.privateca.v1.ICertificate[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listCertificates as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listCertificates with error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificatesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listCertificates = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listCertificates(request), expectedError); + assert((client.innerApiCalls.listCertificates as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listCertificatesStream without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificatesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.security.privateca.v1.Certificate()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1.Certificate()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1.Certificate()), + ]; + client.descriptors.page.listCertificates.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listCertificatesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.security.privateca.v1.Certificate[] = []; + stream.on('data', (response: protos.google.cloud.security.privateca.v1.Certificate) => { + 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.listCertificates.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listCertificates, request)); + assert.strictEqual( + (client.descriptors.page.listCertificates.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listCertificatesStream with error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificatesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listCertificates.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listCertificatesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.security.privateca.v1.Certificate[] = []; + stream.on('data', (response: protos.google.cloud.security.privateca.v1.Certificate) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listCertificates.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listCertificates, request)); + assert.strictEqual( + (client.descriptors.page.listCertificates.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listCertificates without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificatesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.security.privateca.v1.Certificate()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1.Certificate()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1.Certificate()), + ]; + client.descriptors.page.listCertificates.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.security.privateca.v1.ICertificate[] = []; + const iterable = client.listCertificatesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listCertificates.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listCertificates.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listCertificates with error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificatesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listCertificates.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listCertificatesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.security.privateca.v1.ICertificate[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listCertificates.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listCertificates.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listCertificateAuthorities', () => { + it('invokes listCertificateAuthorities without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificateAuthoritiesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateAuthority()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateAuthority()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateAuthority()), + ]; + client.innerApiCalls.listCertificateAuthorities = stubSimpleCall(expectedResponse); + const [response] = await client.listCertificateAuthorities(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listCertificateAuthorities as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listCertificateAuthorities without error using callback', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificateAuthoritiesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateAuthority()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateAuthority()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateAuthority()), + ]; + client.innerApiCalls.listCertificateAuthorities = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listCertificateAuthorities( + request, + (err?: Error|null, result?: protos.google.cloud.security.privateca.v1.ICertificateAuthority[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listCertificateAuthorities as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listCertificateAuthorities with error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificateAuthoritiesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listCertificateAuthorities = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listCertificateAuthorities(request), expectedError); + assert((client.innerApiCalls.listCertificateAuthorities as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listCertificateAuthoritiesStream without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificateAuthoritiesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateAuthority()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateAuthority()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateAuthority()), + ]; + client.descriptors.page.listCertificateAuthorities.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listCertificateAuthoritiesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.security.privateca.v1.CertificateAuthority[] = []; + stream.on('data', (response: protos.google.cloud.security.privateca.v1.CertificateAuthority) => { + 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.listCertificateAuthorities.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listCertificateAuthorities, request)); + assert.strictEqual( + (client.descriptors.page.listCertificateAuthorities.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listCertificateAuthoritiesStream with error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificateAuthoritiesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listCertificateAuthorities.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listCertificateAuthoritiesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.security.privateca.v1.CertificateAuthority[] = []; + stream.on('data', (response: protos.google.cloud.security.privateca.v1.CertificateAuthority) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listCertificateAuthorities.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listCertificateAuthorities, request)); + assert.strictEqual( + (client.descriptors.page.listCertificateAuthorities.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listCertificateAuthorities without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificateAuthoritiesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateAuthority()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateAuthority()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateAuthority()), + ]; + client.descriptors.page.listCertificateAuthorities.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.security.privateca.v1.ICertificateAuthority[] = []; + const iterable = client.listCertificateAuthoritiesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listCertificateAuthorities.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listCertificateAuthorities.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listCertificateAuthorities with error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificateAuthoritiesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listCertificateAuthorities.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listCertificateAuthoritiesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.security.privateca.v1.ICertificateAuthority[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listCertificateAuthorities.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listCertificateAuthorities.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listCaPools', () => { + it('invokes listCaPools without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCaPoolsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.security.privateca.v1.CaPool()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1.CaPool()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1.CaPool()), + ]; + client.innerApiCalls.listCaPools = stubSimpleCall(expectedResponse); + const [response] = await client.listCaPools(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listCaPools as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listCaPools without error using callback', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCaPoolsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.security.privateca.v1.CaPool()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1.CaPool()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1.CaPool()), + ]; + client.innerApiCalls.listCaPools = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listCaPools( + request, + (err?: Error|null, result?: protos.google.cloud.security.privateca.v1.ICaPool[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listCaPools as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listCaPools with error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCaPoolsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listCaPools = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listCaPools(request), expectedError); + assert((client.innerApiCalls.listCaPools as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listCaPoolsStream without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCaPoolsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.security.privateca.v1.CaPool()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1.CaPool()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1.CaPool()), + ]; + client.descriptors.page.listCaPools.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listCaPoolsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.security.privateca.v1.CaPool[] = []; + stream.on('data', (response: protos.google.cloud.security.privateca.v1.CaPool) => { + 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.listCaPools.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listCaPools, request)); + assert.strictEqual( + (client.descriptors.page.listCaPools.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listCaPoolsStream with error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCaPoolsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listCaPools.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listCaPoolsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.security.privateca.v1.CaPool[] = []; + stream.on('data', (response: protos.google.cloud.security.privateca.v1.CaPool) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listCaPools.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listCaPools, request)); + assert.strictEqual( + (client.descriptors.page.listCaPools.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listCaPools without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCaPoolsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.security.privateca.v1.CaPool()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1.CaPool()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1.CaPool()), + ]; + client.descriptors.page.listCaPools.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.security.privateca.v1.ICaPool[] = []; + const iterable = client.listCaPoolsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listCaPools.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listCaPools.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listCaPools with error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCaPoolsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listCaPools.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listCaPoolsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.security.privateca.v1.ICaPool[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listCaPools.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listCaPools.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listCertificateRevocationLists', () => { + it('invokes listCertificateRevocationLists without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificateRevocationListsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateRevocationList()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateRevocationList()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateRevocationList()), + ]; + client.innerApiCalls.listCertificateRevocationLists = stubSimpleCall(expectedResponse); + const [response] = await client.listCertificateRevocationLists(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listCertificateRevocationLists as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listCertificateRevocationLists without error using callback', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificateRevocationListsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateRevocationList()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateRevocationList()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateRevocationList()), + ]; + client.innerApiCalls.listCertificateRevocationLists = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listCertificateRevocationLists( + request, + (err?: Error|null, result?: protos.google.cloud.security.privateca.v1.ICertificateRevocationList[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listCertificateRevocationLists as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listCertificateRevocationLists with error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificateRevocationListsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listCertificateRevocationLists = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listCertificateRevocationLists(request), expectedError); + assert((client.innerApiCalls.listCertificateRevocationLists as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listCertificateRevocationListsStream without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificateRevocationListsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateRevocationList()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateRevocationList()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateRevocationList()), + ]; + client.descriptors.page.listCertificateRevocationLists.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listCertificateRevocationListsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.security.privateca.v1.CertificateRevocationList[] = []; + stream.on('data', (response: protos.google.cloud.security.privateca.v1.CertificateRevocationList) => { + 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.listCertificateRevocationLists.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listCertificateRevocationLists, request)); + assert.strictEqual( + (client.descriptors.page.listCertificateRevocationLists.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listCertificateRevocationListsStream with error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificateRevocationListsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listCertificateRevocationLists.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listCertificateRevocationListsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.security.privateca.v1.CertificateRevocationList[] = []; + stream.on('data', (response: protos.google.cloud.security.privateca.v1.CertificateRevocationList) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listCertificateRevocationLists.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listCertificateRevocationLists, request)); + assert.strictEqual( + (client.descriptors.page.listCertificateRevocationLists.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listCertificateRevocationLists without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificateRevocationListsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateRevocationList()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateRevocationList()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateRevocationList()), + ]; + client.descriptors.page.listCertificateRevocationLists.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.security.privateca.v1.ICertificateRevocationList[] = []; + const iterable = client.listCertificateRevocationListsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listCertificateRevocationLists.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listCertificateRevocationLists.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listCertificateRevocationLists with error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificateRevocationListsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listCertificateRevocationLists.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listCertificateRevocationListsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.security.privateca.v1.ICertificateRevocationList[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listCertificateRevocationLists.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listCertificateRevocationLists.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listCertificateTemplates', () => { + it('invokes listCertificateTemplates without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificateTemplatesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateTemplate()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateTemplate()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateTemplate()), + ]; + client.innerApiCalls.listCertificateTemplates = stubSimpleCall(expectedResponse); + const [response] = await client.listCertificateTemplates(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listCertificateTemplates as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listCertificateTemplates without error using callback', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificateTemplatesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateTemplate()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateTemplate()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateTemplate()), + ]; + client.innerApiCalls.listCertificateTemplates = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listCertificateTemplates( + request, + (err?: Error|null, result?: protos.google.cloud.security.privateca.v1.ICertificateTemplate[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listCertificateTemplates as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listCertificateTemplates with error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificateTemplatesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listCertificateTemplates = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listCertificateTemplates(request), expectedError); + assert((client.innerApiCalls.listCertificateTemplates as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listCertificateTemplatesStream without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificateTemplatesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateTemplate()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateTemplate()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateTemplate()), + ]; + client.descriptors.page.listCertificateTemplates.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listCertificateTemplatesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.security.privateca.v1.CertificateTemplate[] = []; + stream.on('data', (response: protos.google.cloud.security.privateca.v1.CertificateTemplate) => { + 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.listCertificateTemplates.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listCertificateTemplates, request)); + assert.strictEqual( + (client.descriptors.page.listCertificateTemplates.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listCertificateTemplatesStream with error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificateTemplatesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listCertificateTemplates.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listCertificateTemplatesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.security.privateca.v1.CertificateTemplate[] = []; + stream.on('data', (response: protos.google.cloud.security.privateca.v1.CertificateTemplate) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listCertificateTemplates.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listCertificateTemplates, request)); + assert.strictEqual( + (client.descriptors.page.listCertificateTemplates.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listCertificateTemplates without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificateTemplatesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateTemplate()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateTemplate()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateTemplate()), + ]; + client.descriptors.page.listCertificateTemplates.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.security.privateca.v1.ICertificateTemplate[] = []; + const iterable = client.listCertificateTemplatesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listCertificateTemplates.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listCertificateTemplates.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listCertificateTemplates with error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificateTemplatesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listCertificateTemplates.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listCertificateTemplatesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.security.privateca.v1.ICertificateTemplate[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listCertificateTemplates.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listCertificateTemplates.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + 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 certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + 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 certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + 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 certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + 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 certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + 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 certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + 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 certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + 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 certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + 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 certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + 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 certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + 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 certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + 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 certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + 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 certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('caPool', () => { + const fakePath = "/rendered/path/caPool"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + ca_pool: "caPoolValue", + }; + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.caPoolPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.caPoolPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('caPoolPath', () => { + const result = client.caPoolPath("projectValue", "locationValue", "caPoolValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.caPoolPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromCaPoolName', () => { + const result = client.matchProjectFromCaPoolName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.caPoolPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromCaPoolName', () => { + const result = client.matchLocationFromCaPoolName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.caPoolPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCaPoolFromCaPoolName', () => { + const result = client.matchCaPoolFromCaPoolName(fakePath); + assert.strictEqual(result, "caPoolValue"); + assert((client.pathTemplates.caPoolPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('certificate', () => { + const fakePath = "/rendered/path/certificate"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + ca_pool: "caPoolValue", + certificate: "certificateValue", + }; + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.certificatePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.certificatePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('certificatePath', () => { + const result = client.certificatePath("projectValue", "locationValue", "caPoolValue", "certificateValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.certificatePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromCertificateName', () => { + const result = client.matchProjectFromCertificateName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.certificatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromCertificateName', () => { + const result = client.matchLocationFromCertificateName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.certificatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCaPoolFromCertificateName', () => { + const result = client.matchCaPoolFromCertificateName(fakePath); + assert.strictEqual(result, "caPoolValue"); + assert((client.pathTemplates.certificatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCertificateFromCertificateName', () => { + const result = client.matchCertificateFromCertificateName(fakePath); + assert.strictEqual(result, "certificateValue"); + assert((client.pathTemplates.certificatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('certificateAuthority', () => { + const fakePath = "/rendered/path/certificateAuthority"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + ca_pool: "caPoolValue", + certificate_authority: "certificateAuthorityValue", + }; + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.certificateAuthorityPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.certificateAuthorityPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('certificateAuthorityPath', () => { + const result = client.certificateAuthorityPath("projectValue", "locationValue", "caPoolValue", "certificateAuthorityValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.certificateAuthorityPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromCertificateAuthorityName', () => { + const result = client.matchProjectFromCertificateAuthorityName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.certificateAuthorityPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromCertificateAuthorityName', () => { + const result = client.matchLocationFromCertificateAuthorityName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.certificateAuthorityPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCaPoolFromCertificateAuthorityName', () => { + const result = client.matchCaPoolFromCertificateAuthorityName(fakePath); + assert.strictEqual(result, "caPoolValue"); + assert((client.pathTemplates.certificateAuthorityPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCertificateAuthorityFromCertificateAuthorityName', () => { + const result = client.matchCertificateAuthorityFromCertificateAuthorityName(fakePath); + assert.strictEqual(result, "certificateAuthorityValue"); + assert((client.pathTemplates.certificateAuthorityPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('certificateRevocationList', () => { + const fakePath = "/rendered/path/certificateRevocationList"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + ca_pool: "caPoolValue", + certificate_authority: "certificateAuthorityValue", + certificate_revocation_list: "certificateRevocationListValue", + }; + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.certificateRevocationListPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.certificateRevocationListPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('certificateRevocationListPath', () => { + const result = client.certificateRevocationListPath("projectValue", "locationValue", "caPoolValue", "certificateAuthorityValue", "certificateRevocationListValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.certificateRevocationListPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromCertificateRevocationListName', () => { + const result = client.matchProjectFromCertificateRevocationListName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.certificateRevocationListPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromCertificateRevocationListName', () => { + const result = client.matchLocationFromCertificateRevocationListName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.certificateRevocationListPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCaPoolFromCertificateRevocationListName', () => { + const result = client.matchCaPoolFromCertificateRevocationListName(fakePath); + assert.strictEqual(result, "caPoolValue"); + assert((client.pathTemplates.certificateRevocationListPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCertificateAuthorityFromCertificateRevocationListName', () => { + const result = client.matchCertificateAuthorityFromCertificateRevocationListName(fakePath); + assert.strictEqual(result, "certificateAuthorityValue"); + assert((client.pathTemplates.certificateRevocationListPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCertificateRevocationListFromCertificateRevocationListName', () => { + const result = client.matchCertificateRevocationListFromCertificateRevocationListName(fakePath); + assert.strictEqual(result, "certificateRevocationListValue"); + assert((client.pathTemplates.certificateRevocationListPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('certificateTemplate', () => { + const fakePath = "/rendered/path/certificateTemplate"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + certificate_template: "certificateTemplateValue", + }; + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.certificateTemplatePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.certificateTemplatePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('certificateTemplatePath', () => { + const result = client.certificateTemplatePath("projectValue", "locationValue", "certificateTemplateValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.certificateTemplatePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromCertificateTemplateName', () => { + const result = client.matchProjectFromCertificateTemplateName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.certificateTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromCertificateTemplateName', () => { + const result = client.matchLocationFromCertificateTemplateName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.certificateTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCertificateTemplateFromCertificateTemplateName', () => { + const result = client.matchCertificateTemplateFromCertificateTemplateName(fakePath); + assert.strictEqual(result, "certificateTemplateValue"); + assert((client.pathTemplates.certificateTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/v1/tsconfig.json b/owl-bot-staging/v1/tsconfig.json new file mode 100644 index 0000000..c78f1c8 --- /dev/null +++ b/owl-bot-staging/v1/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/owl-bot-staging/v1/webpack.config.js b/owl-bot-staging/v1/webpack.config.js new file mode 100644 index 0000000..a187538 --- /dev/null +++ b/owl-bot-staging/v1/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: 'CertificateAuthorityService', + filename: './certificate-authority-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/owl-bot-staging/v1beta1/.eslintignore b/owl-bot-staging/v1beta1/.eslintignore new file mode 100644 index 0000000..cfc348e --- /dev/null +++ b/owl-bot-staging/v1beta1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/v1beta1/.eslintrc.json b/owl-bot-staging/v1beta1/.eslintrc.json new file mode 100644 index 0000000..7821534 --- /dev/null +++ b/owl-bot-staging/v1beta1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/v1beta1/.gitignore b/owl-bot-staging/v1beta1/.gitignore new file mode 100644 index 0000000..5d32b23 --- /dev/null +++ b/owl-bot-staging/v1beta1/.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/owl-bot-staging/v1beta1/.jsdoc.js b/owl-bot-staging/v1beta1/.jsdoc.js new file mode 100644 index 0000000..8ee4107 --- /dev/null +++ b/owl-bot-staging/v1beta1/.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/security-private-ca', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/v1beta1/.mocharc.js b/owl-bot-staging/v1beta1/.mocharc.js new file mode 100644 index 0000000..481c522 --- /dev/null +++ b/owl-bot-staging/v1beta1/.mocharc.js @@ -0,0 +1,33 @@ +// 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. ** + +const config = { + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000 +} +if (process.env.MOCHA_THROW_DEPRECATION === 'false') { + delete config['throw-deprecation']; +} +if (process.env.MOCHA_REPORTER) { + config.reporter = process.env.MOCHA_REPORTER; +} +if (process.env.MOCHA_REPORTER_OUTPUT) { + config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; +} +module.exports = config diff --git a/owl-bot-staging/v1beta1/.prettierrc.js b/owl-bot-staging/v1beta1/.prettierrc.js new file mode 100644 index 0000000..494e147 --- /dev/null +++ b/owl-bot-staging/v1beta1/.prettierrc.js @@ -0,0 +1,22 @@ +// 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. ** + + +module.exports = { + ...require('gts/.prettierrc.json') +} diff --git a/owl-bot-staging/v1beta1/README.md b/owl-bot-staging/v1beta1/README.md new file mode 100644 index 0000000..c74f8ea --- /dev/null +++ b/owl-bot-staging/v1beta1/README.md @@ -0,0 +1 @@ +Privateca: Nodejs Client diff --git a/owl-bot-staging/v1beta1/linkinator.config.json b/owl-bot-staging/v1beta1/linkinator.config.json new file mode 100644 index 0000000..befd23c --- /dev/null +++ b/owl-bot-staging/v1beta1/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/owl-bot-staging/v1beta1/package.json b/owl-bot-staging/v1beta1/package.json new file mode 100644 index 0000000..541fa74 --- /dev/null +++ b/owl-bot-staging/v1beta1/package.json @@ -0,0 +1,64 @@ +{ + "name": "@google-cloud/security-private-ca", + "version": "0.1.0", + "description": "Privateca client for Node.js", + "repository": "googleapis/nodejs-privateca", + "license": "Apache-2.0", + "author": "Google LLC", + "main": "build/src/index.js", + "files": [ + "build/src", + "build/protos" + ], + "keywords": [ + "google apis client", + "google api client", + "google apis", + "google api", + "google", + "google cloud platform", + "google cloud", + "cloud", + "google privateca", + "privateca", + "certificate authority service" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "predocs-test": "npm run docs", + "docs-test": "linkinator docs", + "fix": "gts fix", + "lint": "gts check", + "prepare": "npm run compile-protos && npm run compile", + "system-test": "c8 mocha build/system-test", + "test": "c8 mocha build/test" + }, + "dependencies": { + "google-gax": "^3.1.1" + }, + "devDependencies": { + "@types/mocha": "^9.1.0", + "@types/node": "^16.0.0", + "@types/sinon": "^10.0.8", + "c8": "^7.11.0", + "gts": "^3.1.0", + "jsdoc": "^3.6.7", + "jsdoc-fresh": "^1.1.1", + "jsdoc-region-tag": "^1.3.1", + "linkinator": "^3.0.0", + "mocha": "^9.1.4", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^13.0.0", + "ts-loader": "^9.2.6", + "typescript": "^4.5.5", + "webpack": "^5.67.0", + "webpack-cli": "^4.9.1" + }, + "engines": { + "node": ">=v12" + } +} diff --git a/owl-bot-staging/v1beta1/protos/google/cloud/security/privateca/v1beta1/resources.proto b/owl-bot-staging/v1beta1/protos/google/cloud/security/privateca/v1beta1/resources.proto new file mode 100644 index 0000000..f2bf7de --- /dev/null +++ b/owl-bot-staging/v1beta1/protos/google/cloud/security/privateca/v1beta1/resources.proto @@ -0,0 +1,903 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.security.privateca.v1beta1; + +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"; +import "google/api/annotations.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Security.PrivateCA.V1Beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/security/privateca/v1beta1;privateca"; +option java_multiple_files = true; +option java_outer_classname = "PrivateCaResourcesProto"; +option java_package = "com.google.cloud.security.privateca.v1beta1"; +option php_namespace = "Google\\Cloud\\Security\\PrivateCA\\V1beta1"; +option ruby_package = "Google::Cloud::Security::PrivateCA::V1beta1"; + +// A [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] represents an individual Certificate Authority. +// A [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] can be used to create [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. +message CertificateAuthority { + option (google.api.resource) = { + type: "privateca.googleapis.com/CertificateAuthority" + pattern: "projects/{project}/locations/{location}/certificateAuthorities/{certificate_authority}" + }; + + // Options that affect all certificates issued by a [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + message IssuingOptions { + // Required. When true, includes a URL to the issuing CA certificate in the + // "authority information access" X.509 extension. + bool include_ca_cert_url = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. When true, includes a URL to the CRL corresponding to certificates + // issued from a [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + // CRLs will expire 7 days from their creation. However, we will rebuild + // daily. CRLs are also rebuilt shortly after a certificate is revoked. + bool include_crl_access_url = 2 [(google.api.field_behavior) = REQUIRED]; + } + + // The issuing policy for a [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + // [Certificates][google.cloud.security.privateca.v1beta1.Certificate] will not be successfully issued from this + // [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] if they violate the policy. + message CertificateAuthorityPolicy { + message AllowedConfigList { + // Required. All [Certificates][google.cloud.security.privateca.v1beta1.Certificate] issued by the [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + // must match at least one listed [ReusableConfigWrapper][google.cloud.security.privateca.v1beta1.ReusableConfigWrapper]. If a + // [ReusableConfigWrapper][google.cloud.security.privateca.v1beta1.ReusableConfigWrapper] has an empty field, any value will be + // allowed for that field. + repeated ReusableConfigWrapper allowed_config_values = 1 [(google.api.field_behavior) = REQUIRED]; + } + + // [AllowedSubjectAltNames][google.cloud.security.privateca.v1beta1.CertificateAuthority.CertificateAuthorityPolicy.AllowedSubjectAltNames] specifies the allowed values for + // [SubjectAltNames][google.cloud.security.privateca.v1beta1.SubjectAltNames] by the [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] when issuing + // [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. + message AllowedSubjectAltNames { + // Optional. Contains valid, fully-qualified host names. Glob patterns are also + // supported. To allow an explicit wildcard certificate, escape with + // backlash (i.e. `\*`). + // E.g. for globbed entries: `*bar.com` will allow `foo.bar.com`, but not + // `*.bar.com`, unless the [allow_globbing_dns_wildcards][google.cloud.security.privateca.v1beta1.CertificateAuthority.CertificateAuthorityPolicy.AllowedSubjectAltNames.allow_globbing_dns_wildcards] field is set. + // E.g. for wildcard entries: `\*.bar.com` will allow `*.bar.com`, but not + // `foo.bar.com`. + repeated string allowed_dns_names = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Contains valid RFC 3986 URIs. Glob patterns are also supported. To + // match across path seperators (i.e. '/') use the double star glob + // pattern (i.e. '**'). + repeated string allowed_uris = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Contains valid RFC 2822 E-mail addresses. Glob patterns are also + // supported. + repeated string allowed_email_addresses = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Contains valid 32-bit IPv4 addresses and subnet ranges or RFC 4291 IPv6 + // addresses and subnet ranges. Subnet ranges are specified using the + // '/' notation (e.g. 10.0.0.0/8, 2001:700:300:1800::/64). Glob patterns + // are supported only for ip address entries (i.e. not for subnet ranges). + repeated string allowed_ips = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specifies if glob patterns used for [allowed_dns_names][google.cloud.security.privateca.v1beta1.CertificateAuthority.CertificateAuthorityPolicy.AllowedSubjectAltNames.allowed_dns_names] allows + // wildcard certificates. + bool allow_globbing_dns_wildcards = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specifies if to allow custom X509Extension values. + bool allow_custom_sans = 6 [(google.api.field_behavior) = OPTIONAL]; + } + + // [IssuanceModes][google.cloud.security.privateca.v1beta1.CertificateAuthority.CertificateAuthorityPolicy.IssuanceModes] specifies the allowed ways in which + // [Certificates][google.cloud.security.privateca.v1beta1.Certificate] may be requested from this + // [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + message IssuanceModes { + // Required. When true, allows callers to create [Certificates][google.cloud.security.privateca.v1beta1.Certificate] by + // specifying a CSR. + bool allow_csr_based_issuance = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. When true, allows callers to create [Certificates][google.cloud.security.privateca.v1beta1.Certificate] by + // specifying a [CertificateConfig][google.cloud.security.privateca.v1beta1.CertificateConfig]. + bool allow_config_based_issuance = 2 [(google.api.field_behavior) = REQUIRED]; + } + + // Allowed configurations or a single configuration for all issued + // certificates. + oneof config_policy { + // Optional. All [Certificates][google.cloud.security.privateca.v1beta1.Certificate] issued by the [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + // must match at least one listed [ReusableConfigWrapper][google.cloud.security.privateca.v1beta1.ReusableConfigWrapper] in the list. + AllowedConfigList allowed_config_list = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. All [Certificates][google.cloud.security.privateca.v1beta1.Certificate] issued by the [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + // will use the provided configuration values, overwriting any requested + // configuration values. + ReusableConfigWrapper overwrite_config_values = 2 [(google.api.field_behavior) = OPTIONAL]; + } + + // Optional. If any [Subject][google.cloud.security.privateca.v1beta1.Subject] is specified here, then all + // [Certificates][google.cloud.security.privateca.v1beta1.Certificate] issued by the [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] must + // match at least one listed [Subject][google.cloud.security.privateca.v1beta1.Subject]. If a [Subject][google.cloud.security.privateca.v1beta1.Subject] has an empty + // field, any value will be allowed for that field. + repeated Subject allowed_locations_and_organizations = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If any value is specified here, then all + // [Certificates][google.cloud.security.privateca.v1beta1.Certificate] issued by the [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] must + // match at least one listed value. If no value is specified, all values + // will be allowed for this fied. Glob patterns are also supported. + repeated string allowed_common_names = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If a [AllowedSubjectAltNames][google.cloud.security.privateca.v1beta1.CertificateAuthority.CertificateAuthorityPolicy.AllowedSubjectAltNames] is specified here, then all + // [Certificates][google.cloud.security.privateca.v1beta1.Certificate] issued by the [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] must + // match [AllowedSubjectAltNames][google.cloud.security.privateca.v1beta1.CertificateAuthority.CertificateAuthorityPolicy.AllowedSubjectAltNames]. If no value or an empty value + // is specified, any value will be allowed for the [SubjectAltNames][google.cloud.security.privateca.v1beta1.SubjectAltNames] + // field. + AllowedSubjectAltNames allowed_sans = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The maximum lifetime allowed by the [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. Note that + // if the any part if the issuing chain expires before a [Certificate][google.cloud.security.privateca.v1beta1.Certificate]'s + // requested maximum_lifetime, the effective lifetime will be explicitly + // truncated. + google.protobuf.Duration maximum_lifetime = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If specified, then only methods allowed in the [IssuanceModes][google.cloud.security.privateca.v1beta1.CertificateAuthority.CertificateAuthorityPolicy.IssuanceModes] may be + // used to issue [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. + IssuanceModes allowed_issuance_modes = 8 [(google.api.field_behavior) = OPTIONAL]; + } + + // URLs where a [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] will publish content. + message AccessUrls { + // The URL where this [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]'s CA certificate is + // published. This will only be set for CAs that have been activated. + string ca_certificate_access_url = 1; + + // The URL where this [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]'s CRLs are published. This + // will only be set for CAs that have been activated. + string crl_access_url = 2; + } + + // A Cloud KMS key configuration that a [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] will use. + message KeyVersionSpec { + oneof KeyVersion { + // Required. The resource name for an existing Cloud KMS CryptoKeyVersion in the + // format + // `projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*`. + // This option enables full flexibility in the key's capabilities and + // properties. + string cloud_kms_key_version = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The algorithm to use for creating a managed Cloud KMS key for a for a + // simplified experience. All managed keys will be have their + // [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] as `HSM`. + SignHashAlgorithm algorithm = 2 [(google.api.field_behavior) = REQUIRED]; + } + } + + // The type of a [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority], indicating its issuing chain. + enum Type { + // Not specified. + TYPE_UNSPECIFIED = 0; + + // Self-signed CA. + SELF_SIGNED = 1; + + // Subordinate CA. Could be issued by a Private CA [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + // or an unmanaged CA. + SUBORDINATE = 2; + } + + // The tier of a [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority], indicating its supported + // functionality and/or billing SKU. + enum Tier { + // Not specified. + TIER_UNSPECIFIED = 0; + + // Enterprise tier. + ENTERPRISE = 1; + + // DevOps tier. + DEVOPS = 2; + } + + // The state of a [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority], indicating if it can be used. + enum State { + // Not specified. + STATE_UNSPECIFIED = 0; + + // Certificates can be issued from this CA. CRLs will be generated for this + // CA. + ENABLED = 1; + + // Certificates cannot be issued from this CA. CRLs will still be generated. + DISABLED = 2; + + // Certificates cannot be issued from this CA. CRLs will not be generated. + PENDING_ACTIVATION = 3; + + // Certificates cannot be issued from this CA. CRLs will not be generated. + PENDING_DELETION = 4; + } + + // The algorithm of a Cloud KMS CryptoKeyVersion of a + // [CryptoKey][google.cloud.kms.v1.CryptoKey] with the + // [CryptoKeyPurpose][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose] value + // `ASYMMETRIC_SIGN`. These values correspond to the + // [CryptoKeyVersionAlgorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm] + // values. For RSA signing algorithms, the PSS algorithms should be preferred, + // use PKCS1 algorithms if required for compatibility. For further + // recommandations, see + // https://cloud.google.com/kms/docs/algorithms#algorithm_recommendations. + enum SignHashAlgorithm { + // Not specified. + SIGN_HASH_ALGORITHM_UNSPECIFIED = 0; + + // maps to CryptoKeyVersionAlgorithm.RSA_SIGN_PSS_2048_SHA256 + RSA_PSS_2048_SHA256 = 1; + + // maps to CryptoKeyVersionAlgorithm. RSA_SIGN_PSS_3072_SHA256 + RSA_PSS_3072_SHA256 = 2; + + // maps to CryptoKeyVersionAlgorithm.RSA_SIGN_PSS_4096_SHA256 + RSA_PSS_4096_SHA256 = 3; + + // maps to CryptoKeyVersionAlgorithm.RSA_SIGN_PKCS1_2048_SHA256 + RSA_PKCS1_2048_SHA256 = 6; + + // maps to CryptoKeyVersionAlgorithm.RSA_SIGN_PKCS1_3072_SHA256 + RSA_PKCS1_3072_SHA256 = 7; + + // maps to CryptoKeyVersionAlgorithm.RSA_SIGN_PKCS1_4096_SHA256 + RSA_PKCS1_4096_SHA256 = 8; + + // maps to CryptoKeyVersionAlgorithm.EC_SIGN_P256_SHA256 + EC_P256_SHA256 = 4; + + // maps to CryptoKeyVersionAlgorithm.EC_SIGN_P384_SHA384 + EC_P384_SHA384 = 5; + } + + // Output only. The resource name for this [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] in the + // format `projects/*/locations/*/certificateAuthorities/*`. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. Immutable. The [Type][google.cloud.security.privateca.v1beta1.CertificateAuthority.Type] of this [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + Type type = 2 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = IMMUTABLE + ]; + + // Required. Immutable. The [Tier][google.cloud.security.privateca.v1beta1.CertificateAuthority.Tier] of this [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + Tier tier = 3 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = IMMUTABLE + ]; + + // Required. Immutable. The config used to create a self-signed X.509 certificate or CSR. + CertificateConfig config = 4 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = IMMUTABLE + ]; + + // Required. The desired lifetime of the CA certificate. Used to create the + // "not_before_time" and "not_after_time" fields inside an X.509 + // certificate. + google.protobuf.Duration lifetime = 5 [(google.api.field_behavior) = REQUIRED]; + + // Required. Immutable. Used when issuing certificates for this [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. If this + // [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] is a self-signed CertificateAuthority, this key + // is also used to sign the self-signed CA certificate. Otherwise, it + // is used to sign a CSR. + KeyVersionSpec key_spec = 6 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = IMMUTABLE + ]; + + // Optional. The [CertificateAuthorityPolicy][google.cloud.security.privateca.v1beta1.CertificateAuthority.CertificateAuthorityPolicy] to enforce when issuing + // [Certificates][google.cloud.security.privateca.v1beta1.Certificate] from this [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + CertificateAuthorityPolicy certificate_policy = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The [IssuingOptions][google.cloud.security.privateca.v1beta1.CertificateAuthority.IssuingOptions] to follow when issuing [Certificates][google.cloud.security.privateca.v1beta1.Certificate] + // from this [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + IssuingOptions issuing_options = 8 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If this is a subordinate [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority], this field will be set + // with the subordinate configuration, which describes its issuers. This may + // be updated, but this [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] must continue to validate. + SubordinateConfig subordinate_config = 19 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The [State][google.cloud.security.privateca.v1beta1.CertificateAuthority.State] for this [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + State state = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. This [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]'s certificate chain, including the current + // [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]'s certificate. Ordered such that the root issuer + // is the final element (consistent with RFC 5246). For a self-signed CA, this + // will only list the current [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]'s certificate. + repeated string pem_ca_certificates = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. A structured description of this [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]'s CA certificate + // and its issuers. Ordered as self-to-root. + repeated CertificateDescription ca_certificate_descriptions = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Immutable. The name of a Cloud Storage bucket where this [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] will + // publish content, such as the CA certificate and CRLs. This must be a bucket + // name, without any prefixes (such as `gs://`) or suffixes (such as + // `.googleapis.com`). For example, to use a bucket named `my-bucket`, you + // would simply specify `my-bucket`. If not specified, a managed bucket will + // be created. + string gcs_bucket = 13 [(google.api.field_behavior) = IMMUTABLE]; + + // Output only. URLs for accessing content published by this CA, such as the CA certificate + // and CRLs. + AccessUrls access_urls = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which this [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] was created. + google.protobuf.Timestamp create_time = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which this [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] was updated. + google.protobuf.Timestamp update_time = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which this [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] will be deleted, if + // scheduled for deletion. + google.protobuf.Timestamp delete_time = 17 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Labels with user-defined metadata. + map labels = 18 [(google.api.field_behavior) = OPTIONAL]; +} + +// A [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList] corresponds to a signed X.509 certificate +// Revocation List (CRL). A CRL contains the serial numbers of certificates that +// should no longer be trusted. +message CertificateRevocationList { + option (google.api.resource) = { + type: "privateca.googleapis.com/CertificateRevocationList" + pattern: "projects/{project}/locations/{location}/certificateAuthorities/{certificate_authority}/certificateRevocationLists/{certificate_revocation_list}" + }; + + // Describes a revoked [Certificate][google.cloud.security.privateca.v1beta1.Certificate]. + message RevokedCertificate { + // The resource path for the [Certificate][google.cloud.security.privateca.v1beta1.Certificate] in the format + // `projects/*/locations/*/certificateAuthorities/*/certificates/*`. + string certificate = 1; + + // The serial number of the [Certificate][google.cloud.security.privateca.v1beta1.Certificate]. + string hex_serial_number = 2; + + // The reason the [Certificate][google.cloud.security.privateca.v1beta1.Certificate] was revoked. + RevocationReason revocation_reason = 3; + } + + // The state of a [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList], indicating if it is current. + enum State { + // Not specified. + STATE_UNSPECIFIED = 0; + + // The [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList] is up to date. + ACTIVE = 1; + + // The [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList] is no longer current. + SUPERSEDED = 2; + } + + // Output only. The resource path for this [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList] in + // the format + // `projects/*/locations/*/certificateAuthorities/*/ + // certificateRevocationLists/*`. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The CRL sequence number that appears in pem_crl. + int64 sequence_number = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The revoked serial numbers that appear in pem_crl. + repeated RevokedCertificate revoked_certificates = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The PEM-encoded X.509 CRL. + string pem_crl = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The location where 'pem_crl' can be accessed. + string access_url = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The [State][google.cloud.security.privateca.v1beta1.CertificateRevocationList.State] for this [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList]. + State state = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which this [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList] was created. + google.protobuf.Timestamp create_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which this [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList] was updated. + google.protobuf.Timestamp update_time = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Labels with user-defined metadata. + map labels = 9 [(google.api.field_behavior) = OPTIONAL]; +} + +// A [Certificate][google.cloud.security.privateca.v1beta1.Certificate] corresponds to a signed X.509 certificate issued by a +// [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. +message Certificate { + option (google.api.resource) = { + type: "privateca.googleapis.com/Certificate" + pattern: "projects/{project}/locations/{location}/certificateAuthorities/{certificate_authority}/certificates/{certificate}" + }; + + // Describes fields that are relavent to the revocation of a [Certificate][google.cloud.security.privateca.v1beta1.Certificate]. + message RevocationDetails { + // Indicates why a [Certificate][google.cloud.security.privateca.v1beta1.Certificate] was revoked. + RevocationReason revocation_state = 1; + + // The time at which this [Certificate][google.cloud.security.privateca.v1beta1.Certificate] was revoked. + google.protobuf.Timestamp revocation_time = 2; + } + + // Output only. The resource path for this [Certificate][google.cloud.security.privateca.v1beta1.Certificate] in the format + // `projects/*/locations/*/certificateAuthorities/*/certificates/*`. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The config used to create a signed X.509 certificate. + oneof certificate_config { + // Immutable. A pem-encoded X.509 certificate signing request (CSR). + string pem_csr = 2 [(google.api.field_behavior) = IMMUTABLE]; + + // Immutable. A description of the certificate and key that does not require X.509 or + // ASN.1. + CertificateConfig config = 3 [(google.api.field_behavior) = IMMUTABLE]; + } + + // Required. Immutable. The desired lifetime of a certificate. Used to create the + // "not_before_time" and "not_after_time" fields inside an X.509 + // certificate. Note that the lifetime may be truncated if it would extend + // past the life of any certificate authority in the issuing chain. + google.protobuf.Duration lifetime = 4 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = IMMUTABLE + ]; + + // Output only. Details regarding the revocation of this [Certificate][google.cloud.security.privateca.v1beta1.Certificate]. This + // [Certificate][google.cloud.security.privateca.v1beta1.Certificate] is considered revoked if and only if this field is present. + RevocationDetails revocation_details = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The pem-encoded, signed X.509 certificate. + string pem_certificate = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. A structured description of the issued X.509 certificate. + CertificateDescription certificate_description = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The chain that may be used to verify the X.509 certificate. Expected to be + // in issuer-to-root order according to RFC 5246. + repeated string pem_certificate_chain = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which this [Certificate][google.cloud.security.privateca.v1beta1.Certificate] was created. + google.protobuf.Timestamp create_time = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which this [Certificate][google.cloud.security.privateca.v1beta1.Certificate] was updated. + google.protobuf.Timestamp update_time = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Labels with user-defined metadata. + map labels = 11 [(google.api.field_behavior) = OPTIONAL]; +} + +// A [ReusableConfig][google.cloud.security.privateca.v1beta1.ReusableConfig] refers to a managed [ReusableConfigValues][google.cloud.security.privateca.v1beta1.ReusableConfigValues]. Those, in +// turn, are used to describe certain fields of an X.509 certificate, such as +// the key usage fields, fields specific to CA certificates, certificate policy +// extensions and custom extensions. +message ReusableConfig { + option (google.api.resource) = { + type: "privateca.googleapis.com/ReusableConfig" + pattern: "projects/{project}/locations/{location}/reusableConfigs/{reusable_config}" + }; + + // Output only. The resource path for this [ReusableConfig][google.cloud.security.privateca.v1beta1.ReusableConfig] in the format + // `projects/*/locations/*/reusableConfigs/*`. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. The config values. + ReusableConfigValues values = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A human-readable description of scenarios these ReusableConfigValues may be + // compatible with. + string description = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The time at which this [ReusableConfig][google.cloud.security.privateca.v1beta1.ReusableConfig] was created. + google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which this [ReusableConfig][google.cloud.security.privateca.v1beta1.ReusableConfig] was updated. + google.protobuf.Timestamp update_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Labels with user-defined metadata. + map labels = 6 [(google.api.field_behavior) = OPTIONAL]; +} + +// A [ReusableConfigValues][google.cloud.security.privateca.v1beta1.ReusableConfigValues] is used to describe certain fields of an +// X.509 certificate, such as the key usage fields, fields specific to CA +// certificates, certificate policy extensions and custom extensions. +message ReusableConfigValues { + // Describes values that are relevant in a CA certificate. + message CaOptions { + // Optional. Refers to the "CA" X.509 extension, which is a boolean value. When this + // value is missing, the extension will be omitted from the CA certificate. + google.protobuf.BoolValue is_ca = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Refers to the path length restriction X.509 extension. For a CA + // certificate, this value describes the depth of subordinate CA + // certificates that are allowed. + // If this value is less than 0, the request will fail. + // If this value is missing, the max path length will be omitted from the + // CA certificate. + google.protobuf.Int32Value max_issuer_path_length = 2 [(google.api.field_behavior) = OPTIONAL]; + } + + // Optional. Indicates the intended use for keys that correspond to a certificate. + KeyUsage key_usage = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Describes options in this [ReusableConfigValues][google.cloud.security.privateca.v1beta1.ReusableConfigValues] that are + // relevant in a CA certificate. + CaOptions ca_options = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Describes the X.509 certificate policy object identifiers, per + // https://tools.ietf.org/html/rfc5280#section-4.2.1.4. + repeated ObjectId policy_ids = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Describes Online Certificate Status Protocol (OCSP) endpoint addresses + // that appear in the "Authority Information Access" extension in the + // certificate. + repeated string aia_ocsp_servers = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Describes custom X.509 extensions. + repeated X509Extension additional_extensions = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// A [ReusableConfigWrapper][google.cloud.security.privateca.v1beta1.ReusableConfigWrapper] describes values that may assist in creating an +// X.509 certificate, or a reference to a pre-defined set of values. +message ReusableConfigWrapper { + // Reusable or inline config values. + oneof config_values { + // Required. A resource path to a [ReusableConfig][google.cloud.security.privateca.v1beta1.ReusableConfig] in the format + // `projects/*/locations/*/reusableConfigs/*`. + string reusable_config = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. A user-specified inline [ReusableConfigValues][google.cloud.security.privateca.v1beta1.ReusableConfigValues]. + ReusableConfigValues reusable_config_values = 2 [(google.api.field_behavior) = REQUIRED]; + } +} + +// Describes a subordinate CA's issuers. This is either a resource path to a +// known issuing [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority], or a PEM issuer certificate chain. +message SubordinateConfig { + // This message describes a subordinate CA's issuer certificate chain. This + // wrapper exists for compatibility reasons. + message SubordinateConfigChain { + // Required. Expected to be in leaf-to-root order according to RFC 5246. + repeated string pem_certificates = 1 [(google.api.field_behavior) = REQUIRED]; + } + + oneof subordinate_config { + // Required. This can refer to a [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] in the same project that + // was used to create a subordinate [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. This field + // is used for information and usability purposes only. The resource name + // is in the format `projects/*/locations/*/certificateAuthorities/*`. + string certificate_authority = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Contains the PEM certificate chain for the issuers of this + // [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority], but not pem certificate for this CA itself. + SubordinateConfigChain pem_issuer_chain = 2 [(google.api.field_behavior) = REQUIRED]; + } +} + +// A [PublicKey][google.cloud.security.privateca.v1beta1.PublicKey] describes a public key. +message PublicKey { + // Types of public keys that are supported. + // At a minimum, we support RSA and ECDSA, for the key sizes or curves listed: + // https://cloud.google.com/kms/docs/algorithms#asymmetric_signing_algorithms + enum KeyType { + // Default unspecified value. + KEY_TYPE_UNSPECIFIED = 0; + + // A PEM-encoded PKCS#1/RFC 3447 RSAPrivateKey structure. + PEM_RSA_KEY = 1; + + // A PEM-encoded compressed NIST P-256/secp256r1/prime256v1 or P-384 key. + PEM_EC_KEY = 2; + } + + // Required. The type of public key. + KeyType type = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. A public key. Padding and encoding varies by 'KeyType' and is described + // along with the KeyType values. + bytes key = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// A [CertificateConfig][google.cloud.security.privateca.v1beta1.CertificateConfig] describes an X.509 certificate or CSR that is to be +// created, as an alternative to using ASN.1. +message CertificateConfig { + // These values are used to create the distinguished name and subject + // alternative name fields in an X.509 certificate. + message SubjectConfig { + // Required. Contains distinguished name fields such as the location and organization. + Subject subject = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The "common name" of the distinguished name. + string common_name = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The subject alternative name fields. + SubjectAltNames subject_alt_name = 3 [(google.api.field_behavior) = OPTIONAL]; + } + + // Required. Specifies some of the values in a certificate that are related to the + // subject. + SubjectConfig subject_config = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Describes how some of the technical fields in a certificate should be + // populated. + ReusableConfigWrapper reusable_config = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The public key that corresponds to this config. This is, for example, used + // when issuing [Certificates][google.cloud.security.privateca.v1beta1.Certificate], but not when creating a + // self-signed [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] or [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] CSR. + PublicKey public_key = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// A [CertificateDescription][google.cloud.security.privateca.v1beta1.CertificateDescription] describes an X.509 certificate or CSR that has +// been issued, as an alternative to using ASN.1 / X.509. +message CertificateDescription { + // These values describe fields in an issued X.509 certificate such as the + // distinguished name, subject alternative names, serial number, and lifetime. + message SubjectDescription { + // Contains distinguished name fields such as the location and organization. + Subject subject = 1; + + // The "common name" of the distinguished name. + string common_name = 2; + + // The subject alternative name fields. + SubjectAltNames subject_alt_name = 3; + + // The serial number encoded in lowercase hexadecimal. + string hex_serial_number = 4; + + // For convenience, the actual lifetime of an issued certificate. + // Corresponds to 'not_after_time' - 'not_before_time'. + google.protobuf.Duration lifetime = 5; + + // The time at which the certificate becomes valid. + google.protobuf.Timestamp not_before_time = 6; + + // The time at which the certificate expires. + google.protobuf.Timestamp not_after_time = 7; + } + + // A KeyId identifies a specific public key, usually by hashing the public + // key. + message KeyId { + // Optional. The value of this KeyId encoded in lowercase hexadecimal. This is most + // likely the 160 bit SHA-1 hash of the public key. + string key_id = 1 [(google.api.field_behavior) = OPTIONAL]; + } + + // A group of fingerprints for the x509 certificate. + message CertificateFingerprint { + // The SHA 256 hash, encoded in hexadecimal, of the DER x509 certificate. + string sha256_hash = 1; + } + + // Describes some of the values in a certificate that are related to the + // subject and lifetime. + SubjectDescription subject_description = 1; + + // Describes some of the technical fields in a certificate. + ReusableConfigValues config_values = 2; + + // The public key that corresponds to an issued certificate. + PublicKey public_key = 3; + + // Provides a means of identifiying certificates that contain a particular + // public key, per https://tools.ietf.org/html/rfc5280#section-4.2.1.2. + KeyId subject_key_id = 4; + + // Identifies the subject_key_id of the parent certificate, per + // https://tools.ietf.org/html/rfc5280#section-4.2.1.1 + KeyId authority_key_id = 5; + + // Describes a list of locations to obtain CRL information, i.e. + // the DistributionPoint.fullName described by + // https://tools.ietf.org/html/rfc5280#section-4.2.1.13 + repeated string crl_distribution_points = 6; + + // Describes lists of issuer CA certificate URLs that appear in the + // "Authority Information Access" extension in the certificate. + repeated string aia_issuing_certificate_urls = 7; + + // The hash of the x.509 certificate. + CertificateFingerprint cert_fingerprint = 8; +} + +// An [ObjectId][google.cloud.security.privateca.v1beta1.ObjectId] specifies an object identifier (OID). These provide context +// and describe types in ASN.1 messages. +message ObjectId { + // Required. The parts of an OID path. The most significant parts of the path come + // first. + repeated int32 object_id_path = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// An [X509Extension][google.cloud.security.privateca.v1beta1.X509Extension] specifies an X.509 extension, which may be used in +// different parts of X.509 objects like certificates, CSRs, and CRLs. +message X509Extension { + // Required. The OID for this X.509 extension. + ObjectId object_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Indicates whether or not this extension is critical (i.e., if the client + // does not know how to handle this extension, the client should consider this + // to be an error). + bool critical = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The value of this X.509 extension. + bytes value = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// A [KeyUsage][google.cloud.security.privateca.v1beta1.KeyUsage] describes key usage values that may appear in an X.509 +// certificate. +message KeyUsage { + // [KeyUsage.KeyUsageOptions][google.cloud.security.privateca.v1beta1.KeyUsage.KeyUsageOptions] corresponds to the key usage values + // described in https://tools.ietf.org/html/rfc5280#section-4.2.1.3. + message KeyUsageOptions { + // The key may be used for digital signatures. + bool digital_signature = 1; + + // The key may be used for cryptographic commitments. Note that this may + // also be referred to as "non-repudiation". + bool content_commitment = 2; + + // The key may be used to encipher other keys. + bool key_encipherment = 3; + + // The key may be used to encipher data. + bool data_encipherment = 4; + + // The key may be used in a key agreement protocol. + bool key_agreement = 5; + + // The key may be used to sign certificates. + bool cert_sign = 6; + + // The key may be used sign certificate revocation lists. + bool crl_sign = 7; + + // The key may be used to encipher only. + bool encipher_only = 8; + + // The key may be used to decipher only. + bool decipher_only = 9; + } + + // [KeyUsage.ExtendedKeyUsageOptions][google.cloud.security.privateca.v1beta1.KeyUsage.ExtendedKeyUsageOptions] has fields that correspond to + // certain common OIDs that could be specified as an extended key usage value. + message ExtendedKeyUsageOptions { + // Corresponds to OID 1.3.6.1.5.5.7.3.1. Officially described as "TLS WWW + // server authentication", though regularly used for non-WWW TLS. + bool server_auth = 1; + + // Corresponds to OID 1.3.6.1.5.5.7.3.2. Officially described as "TLS WWW + // client authentication", though regularly used for non-WWW TLS. + bool client_auth = 2; + + // Corresponds to OID 1.3.6.1.5.5.7.3.3. Officially described as "Signing of + // downloadable executable code client authentication". + bool code_signing = 3; + + // Corresponds to OID 1.3.6.1.5.5.7.3.4. Officially described as "Email + // protection". + bool email_protection = 4; + + // Corresponds to OID 1.3.6.1.5.5.7.3.8. Officially described as "Binding + // the hash of an object to a time". + bool time_stamping = 5; + + // Corresponds to OID 1.3.6.1.5.5.7.3.9. Officially described as "Signing + // OCSP responses". + bool ocsp_signing = 6; + } + + // Describes high-level ways in which a key may be used. + KeyUsageOptions base_key_usage = 1; + + // Detailed scenarios in which a key may be used. + ExtendedKeyUsageOptions extended_key_usage = 2; + + // Used to describe extended key usages that are not listed in the + // [KeyUsage.ExtendedKeyUsageOptions][google.cloud.security.privateca.v1beta1.KeyUsage.ExtendedKeyUsageOptions] message. + repeated ObjectId unknown_extended_key_usages = 3; +} + +// [Subject][google.cloud.security.privateca.v1beta1.Subject] describes parts of a distinguished name that, in turn, +// describes the subject of the certificate. +message Subject { + // The country code of the subject. + string country_code = 1; + + // The organization of the subject. + string organization = 2; + + // The organizational_unit of the subject. + string organizational_unit = 3; + + // The locality or city of the subject. + string locality = 4; + + // The province, territory, or regional state of the subject. + string province = 5; + + // The street address of the subject. + string street_address = 6; + + // The postal code of the subject. + string postal_code = 7; +} + +// [SubjectAltNames][google.cloud.security.privateca.v1beta1.SubjectAltNames] corresponds to a more modern way of listing what +// the asserted identity is in a certificate (i.e., compared to the "common +// name" in the distinguished name). +message SubjectAltNames { + // Contains only valid, fully-qualified host names. + repeated string dns_names = 1; + + // Contains only valid RFC 3986 URIs. + repeated string uris = 2; + + // Contains only valid RFC 2822 E-mail addresses. + repeated string email_addresses = 3; + + // Contains only valid 32-bit IPv4 addresses or RFC 4291 IPv6 addresses. + repeated string ip_addresses = 4; + + // Contains additional subject alternative name values. + repeated X509Extension custom_sans = 5; +} + +// A [RevocationReason][google.cloud.security.privateca.v1beta1.RevocationReason] indicates whether a [Certificate][google.cloud.security.privateca.v1beta1.Certificate] has been revoked, +// and the reason for revocation. These correspond to standard revocation +// reasons from RFC 5280. Note that the enum labels and values in this +// definition are not the same ASN.1 values defined in RFC 5280. These values +// will be translated to the correct ASN.1 values when a CRL is created. +enum RevocationReason { + // Default unspecified value. This value does indicate that a [Certificate][google.cloud.security.privateca.v1beta1.Certificate] + // has been revoked, but that a reason has not been recorded. + REVOCATION_REASON_UNSPECIFIED = 0; + + // Key material for this [Certificate][google.cloud.security.privateca.v1beta1.Certificate] may have leaked. + KEY_COMPROMISE = 1; + + // The key material for a certificate authority in the issuing path may have + // leaked. + CERTIFICATE_AUTHORITY_COMPROMISE = 2; + + // The subject or other attributes in this [Certificate][google.cloud.security.privateca.v1beta1.Certificate] have changed. + AFFILIATION_CHANGED = 3; + + // This [Certificate][google.cloud.security.privateca.v1beta1.Certificate] has been superseded. + SUPERSEDED = 4; + + // This [Certificate][google.cloud.security.privateca.v1beta1.Certificate] or entities in the issuing path have ceased to + // operate. + CESSATION_OF_OPERATION = 5; + + // This [Certificate][google.cloud.security.privateca.v1beta1.Certificate] should not be considered valid, it is expected that it + // may become valid in the future. + CERTIFICATE_HOLD = 6; + + // This [Certificate][google.cloud.security.privateca.v1beta1.Certificate] no longer has permission to assert the listed + // attributes. + PRIVILEGE_WITHDRAWN = 7; + + // The authority which determines appropriate attributes for a [Certificate][google.cloud.security.privateca.v1beta1.Certificate] + // may have been compromised. + ATTRIBUTE_AUTHORITY_COMPROMISE = 8; +} diff --git a/owl-bot-staging/v1beta1/protos/google/cloud/security/privateca/v1beta1/service.proto b/owl-bot-staging/v1beta1/protos/google/cloud/security/privateca/v1beta1/service.proto new file mode 100644 index 0000000..3cc010d --- /dev/null +++ b/owl-bot-staging/v1beta1/protos/google/cloud/security/privateca/v1beta1/service.proto @@ -0,0 +1,871 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.security.privateca.v1beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/security/privateca/v1beta1/resources.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Security.PrivateCA.V1Beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/security/privateca/v1beta1;privateca"; +option java_multiple_files = true; +option java_outer_classname = "PrivateCaProto"; +option java_package = "com.google.cloud.security.privateca.v1beta1"; +option php_namespace = "Google\\Cloud\\Security\\PrivateCA\\V1beta1"; +option ruby_package = "Google::Cloud::Security::PrivateCA::V1beta1"; + +// [Certificate Authority Service][google.cloud.security.privateca.v1beta1.CertificateAuthorityService] manages private +// certificate authorities and issued certificates. +service CertificateAuthorityService { + option (google.api.default_host) = "privateca.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Create a new [Certificate][google.cloud.security.privateca.v1beta1.Certificate] in a given Project, Location from a particular + // [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + rpc CreateCertificate(CreateCertificateRequest) returns (Certificate) { + option (google.api.http) = { + post: "/v1beta1/{parent=projects/*/locations/*/certificateAuthorities/*}/certificates" + body: "certificate" + }; + option (google.api.method_signature) = "parent,certificate,certificate_id"; + } + + // Returns a [Certificate][google.cloud.security.privateca.v1beta1.Certificate]. + rpc GetCertificate(GetCertificateRequest) returns (Certificate) { + option (google.api.http) = { + get: "/v1beta1/{name=projects/*/locations/*/certificateAuthorities/*/certificates/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. + rpc ListCertificates(ListCertificatesRequest) returns (ListCertificatesResponse) { + option (google.api.http) = { + get: "/v1beta1/{parent=projects/*/locations/*/certificateAuthorities/*}/certificates" + }; + option (google.api.method_signature) = "parent"; + } + + // Revoke a [Certificate][google.cloud.security.privateca.v1beta1.Certificate]. + rpc RevokeCertificate(RevokeCertificateRequest) returns (Certificate) { + option (google.api.http) = { + post: "/v1beta1/{name=projects/*/locations/*/certificateAuthorities/*/certificates/*}:revoke" + body: "*" + }; + option (google.api.method_signature) = "name"; + } + + // Update a [Certificate][google.cloud.security.privateca.v1beta1.Certificate]. Currently, the only field you can update is the + // [labels][google.cloud.security.privateca.v1beta1.Certificate.labels] field. + rpc UpdateCertificate(UpdateCertificateRequest) returns (Certificate) { + option (google.api.http) = { + patch: "/v1beta1/{certificate.name=projects/*/locations/*/certificateAuthorities/*/certificates/*}" + body: "certificate" + }; + option (google.api.method_signature) = "certificate,update_mask"; + } + + // Activate a [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] that is in state + // [PENDING_ACTIVATION][google.cloud.security.privateca.v1beta1.CertificateAuthority.State.PENDING_ACTIVATION] and is + // of type [SUBORDINATE][google.cloud.security.privateca.v1beta1.CertificateAuthority.Type.SUBORDINATE]. After the + // parent Certificate Authority signs a certificate signing request from + // [FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.FetchCertificateAuthorityCsr], this method can complete the activation + // process. + rpc ActivateCertificateAuthority(ActivateCertificateAuthorityRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta1/{name=projects/*/locations/*/certificateAuthorities/*}:activate" + body: "*" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "CertificateAuthority" + metadata_type: "OperationMetadata" + }; + } + + // Create a new [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] in a given Project and Location. + rpc CreateCertificateAuthority(CreateCertificateAuthorityRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta1/{parent=projects/*/locations/*}/certificateAuthorities" + body: "certificate_authority" + }; + option (google.api.method_signature) = "parent,certificate_authority,certificate_authority_id"; + option (google.longrunning.operation_info) = { + response_type: "CertificateAuthority" + metadata_type: "OperationMetadata" + }; + } + + // Disable a [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + rpc DisableCertificateAuthority(DisableCertificateAuthorityRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta1/{name=projects/*/locations/*/certificateAuthorities/*}:disable" + body: "*" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "CertificateAuthority" + metadata_type: "OperationMetadata" + }; + } + + // Enable a [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + rpc EnableCertificateAuthority(EnableCertificateAuthorityRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta1/{name=projects/*/locations/*/certificateAuthorities/*}:enable" + body: "*" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "CertificateAuthority" + metadata_type: "OperationMetadata" + }; + } + + // Fetch a certificate signing request (CSR) from a [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + // that is in state + // [PENDING_ACTIVATION][google.cloud.security.privateca.v1beta1.CertificateAuthority.State.PENDING_ACTIVATION] and is + // of type [SUBORDINATE][google.cloud.security.privateca.v1beta1.CertificateAuthority.Type.SUBORDINATE]. The CSR must + // then be signed by the desired parent Certificate Authority, which could be + // another [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] resource, or could be an on-prem + // certificate authority. See also [ActivateCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ActivateCertificateAuthority]. + rpc FetchCertificateAuthorityCsr(FetchCertificateAuthorityCsrRequest) returns (FetchCertificateAuthorityCsrResponse) { + option (google.api.http) = { + get: "/v1beta1/{name=projects/*/locations/*/certificateAuthorities/*}:fetch" + }; + option (google.api.method_signature) = "name"; + } + + // Returns a [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + rpc GetCertificateAuthority(GetCertificateAuthorityRequest) returns (CertificateAuthority) { + option (google.api.http) = { + get: "/v1beta1/{name=projects/*/locations/*/certificateAuthorities/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists [CertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + rpc ListCertificateAuthorities(ListCertificateAuthoritiesRequest) returns (ListCertificateAuthoritiesResponse) { + option (google.api.http) = { + get: "/v1beta1/{parent=projects/*/locations/*}/certificateAuthorities" + }; + option (google.api.method_signature) = "parent"; + } + + // Restore a [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] that is scheduled for deletion. + rpc RestoreCertificateAuthority(RestoreCertificateAuthorityRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta1/{name=projects/*/locations/*/certificateAuthorities/*}:restore" + body: "*" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "CertificateAuthority" + metadata_type: "OperationMetadata" + }; + } + + // Schedule a [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] for deletion. + rpc ScheduleDeleteCertificateAuthority(ScheduleDeleteCertificateAuthorityRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta1/{name=projects/*/locations/*/certificateAuthorities/*}:scheduleDelete" + body: "*" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "CertificateAuthority" + metadata_type: "OperationMetadata" + }; + } + + // Update a [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + rpc UpdateCertificateAuthority(UpdateCertificateAuthorityRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1beta1/{certificate_authority.name=projects/*/locations/*/certificateAuthorities/*}" + body: "certificate_authority" + }; + option (google.api.method_signature) = "certificate_authority,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "CertificateAuthority" + metadata_type: "OperationMetadata" + }; + } + + // Returns a [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList]. + rpc GetCertificateRevocationList(GetCertificateRevocationListRequest) returns (CertificateRevocationList) { + option (google.api.http) = { + get: "/v1beta1/{name=projects/*/locations/*/certificateAuthorities/*/certificateRevocationLists/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists [CertificateRevocationLists][google.cloud.security.privateca.v1beta1.CertificateRevocationList]. + rpc ListCertificateRevocationLists(ListCertificateRevocationListsRequest) returns (ListCertificateRevocationListsResponse) { + option (google.api.http) = { + get: "/v1beta1/{parent=projects/*/locations/*/certificateAuthorities/*}/certificateRevocationLists" + }; + option (google.api.method_signature) = "parent"; + } + + // Update a [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList]. + rpc UpdateCertificateRevocationList(UpdateCertificateRevocationListRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1beta1/{certificate_revocation_list.name=projects/*/locations/*/certificateAuthorities/*/certificateRevocationLists/*}" + body: "certificate_revocation_list" + }; + option (google.api.method_signature) = "certificate_revocation_list,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "CertificateRevocationList" + metadata_type: "OperationMetadata" + }; + } + + // Returns a [ReusableConfig][google.cloud.security.privateca.v1beta1.ReusableConfig]. + rpc GetReusableConfig(GetReusableConfigRequest) returns (ReusableConfig) { + option (google.api.http) = { + get: "/v1beta1/{name=projects/*/locations/*/reusableConfigs/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists [ReusableConfigs][google.cloud.security.privateca.v1beta1.ReusableConfig]. + rpc ListReusableConfigs(ListReusableConfigsRequest) returns (ListReusableConfigsResponse) { + option (google.api.http) = { + get: "/v1beta1/{parent=projects/*/locations/*}/reusableConfigs" + }; + option (google.api.method_signature) = "parent"; + } +} + +// Request message for [CertificateAuthorityService.CreateCertificate][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.CreateCertificate]. +message CreateCertificateRequest { + // Required. The resource name of the location and [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + // associated with the [Certificate][google.cloud.security.privateca.v1beta1.Certificate], in the format + // `projects/*/locations/*/certificateAuthorities/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "privateca.googleapis.com/CertificateAuthority" + } + ]; + + // Optional. It must be unique within a location and match the regular + // expression `[a-zA-Z0-9_-]{1,63}`. This field is required when using a + // [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] in the Enterprise [CertificateAuthority.Tier][google.cloud.security.privateca.v1beta1.CertificateAuthority.Tier], + // but is optional and its value is ignored otherwise. + string certificate_id = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Required. A [Certificate][google.cloud.security.privateca.v1beta1.Certificate] with initial field values. + Certificate certificate = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An ID to identify requests. Specify a unique request ID so that if you must + // retry your request, the server will know to ignore the request if it has + // already been completed. The server will guarantee that for at least 60 + // minutes since the first request. + // + // For example, consider a situation where you make an initial request and t + // he request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [CertificateAuthorityService.GetCertificate][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetCertificate]. +message GetCertificateRequest { + // Required. The [name][google.cloud.security.privateca.v1beta1.Certificate.name] of the [Certificate][google.cloud.security.privateca.v1beta1.Certificate] to get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "privateca.googleapis.com/Certificate" + } + ]; +} + +// Request message for [CertificateAuthorityService.ListCertificates][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificates]. +message ListCertificatesRequest { + // Required. The resource name of the location associated with the + // [Certificates][google.cloud.security.privateca.v1beta1.Certificate], in the format + // `projects/*/locations/*/certificateauthorities/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "privateca.googleapis.com/CertificateAuthority" + } + ]; + + // Optional. Limit on the number of + // [Certificates][google.cloud.security.privateca.v1beta1.Certificate] to include in the + // response. Further [Certificates][google.cloud.security.privateca.v1beta1.Certificate] can subsequently be obtained + // by including the + // [ListCertificatesResponse.next_page_token][google.cloud.security.privateca.v1beta1.ListCertificatesResponse.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. Pagination token, returned earlier via + // [ListCertificatesResponse.next_page_token][google.cloud.security.privateca.v1beta1.ListCertificatesResponse.next_page_token]. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Only include resources that match the filter in the response. For details + // on supported filters and syntax, see [Certificates Filtering + // documentation](https://cloud.google.com/certificate-authority-service/docs/sorting-filtering-certificates#filtering_support). + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specify how the results should be sorted. For details on supported fields + // and syntax, see [Certificates Sorting + // documentation](https://cloud.google.com/certificate-authority-service/docs/sorting-filtering-certificates#sorting_support). + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for [CertificateAuthorityService.ListCertificates][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificates]. +message ListCertificatesResponse { + // The list of [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. + repeated Certificate certificates = 1; + + // A token to retrieve next page of results. Pass this value in + // [ListCertificatesRequest.next_page_token][] to retrieve the + // next page of results. + string next_page_token = 2; + + // A list of locations (e.g. "us-west1") that could not be reached. + repeated string unreachable = 3; +} + +// Request message for +// [CertificateAuthorityService.RevokeCertificate][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.RevokeCertificate]. +message RevokeCertificateRequest { + // Required. The resource name for this [Certificate][google.cloud.security.privateca.v1beta1.Certificate] in the + // format `projects/*/locations/*/certificateAuthorities/*/certificates/*`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "privateca.googleapis.com/Certificate" + } + ]; + + // Required. The [RevocationReason][google.cloud.security.privateca.v1beta1.RevocationReason] for revoking this certificate. + RevocationReason reason = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An ID to identify requests. Specify a unique request ID so that if you must + // retry your request, the server will know to ignore the request if it has + // already been completed. The server will guarantee that for at least 60 + // minutes since the first request. + // + // For example, consider a situation where you make an initial request and t + // he request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for [CertificateAuthorityService.UpdateCertificate][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.UpdateCertificate]. +message UpdateCertificateRequest { + // Required. [Certificate][google.cloud.security.privateca.v1beta1.Certificate] with updated values. + Certificate certificate = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. A list of fields to be updated in this request. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An ID to identify requests. Specify a unique request ID so that if you must + // retry your request, the server will know to ignore the request if it has + // already been completed. The server will guarantee that for at least 60 + // minutes since the first request. + // + // For example, consider a situation where you make an initial request and t + // he request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [CertificateAuthorityService.ActivateCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ActivateCertificateAuthority]. +message ActivateCertificateAuthorityRequest { + // Required. The resource name for this [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] in the + // format `projects/*/locations/*/certificateAuthorities/*`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "privateca.googleapis.com/CertificateAuthority" + } + ]; + + // Required. The signed CA certificate issued from + // [FetchCertificateAuthorityCsrResponse.pem_csr][google.cloud.security.privateca.v1beta1.FetchCertificateAuthorityCsrResponse.pem_csr]. + string pem_ca_certificate = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Must include information about the issuer of 'pem_ca_certificate', and any + // further issuers until the self-signed CA. + SubordinateConfig subordinate_config = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An ID to identify requests. Specify a unique request ID so that if you must + // retry your request, the server will know to ignore the request if it has + // already been completed. The server will guarantee that for at least 60 + // minutes since the first request. + // + // For example, consider a situation where you make an initial request and t + // he request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [CertificateAuthorityService.CreateCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.CreateCertificateAuthority]. +message CreateCertificateAuthorityRequest { + // Required. The resource name of the location associated with the + // [CertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthority], 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 certificate_authority_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. A [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] with initial field values. + CertificateAuthority certificate_authority = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An ID to identify requests. Specify a unique request ID so that if you must + // retry your request, the server will know to ignore the request if it has + // already been completed. The server will guarantee that for at least 60 + // minutes since the first request. + // + // For example, consider a situation where you make an initial request and t + // he request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [CertificateAuthorityService.DisableCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.DisableCertificateAuthority]. +message DisableCertificateAuthorityRequest { + // Required. The resource name for this [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] in the + // format `projects/*/locations/*/certificateAuthorities/*`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "privateca.googleapis.com/CertificateAuthority" + } + ]; + + // Optional. An ID to identify requests. Specify a unique request ID so that if you must + // retry your request, the server will know to ignore the request if it has + // already been completed. The server will guarantee that for at least 60 + // minutes since the first request. + // + // For example, consider a situation where you make an initial request and t + // he request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [CertificateAuthorityService.EnableCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.EnableCertificateAuthority]. +message EnableCertificateAuthorityRequest { + // Required. The resource name for this [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] in the + // format `projects/*/locations/*/certificateAuthorities/*`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "privateca.googleapis.com/CertificateAuthority" + } + ]; + + // Optional. An ID to identify requests. Specify a unique request ID so that if you must + // retry your request, the server will know to ignore the request if it has + // already been completed. The server will guarantee that for at least 60 + // minutes since the first request. + // + // For example, consider a situation where you make an initial request and t + // he request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [CertificateAuthorityService.FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.FetchCertificateAuthorityCsr]. +message FetchCertificateAuthorityCsrRequest { + // Required. The resource name for this [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] in the + // format `projects/*/locations/*/certificateAuthorities/*`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "privateca.googleapis.com/CertificateAuthority" + } + ]; +} + +// Response message for +// [CertificateAuthorityService.FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.FetchCertificateAuthorityCsr]. +message FetchCertificateAuthorityCsrResponse { + // Output only. The PEM-encoded signed certificate signing request (CSR). + string pem_csr = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Request message for [CertificateAuthorityService.GetCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetCertificateAuthority]. +message GetCertificateAuthorityRequest { + // Required. The [name][google.cloud.security.privateca.v1beta1.CertificateAuthority.name] of the [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] to + // get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "privateca.googleapis.com/CertificateAuthority" + } + ]; +} + +// Request message for +// [CertificateAuthorityService.ListCertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificateAuthorities]. +message ListCertificateAuthoritiesRequest { + // Required. The resource name of the location associated with the + // [CertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthority], in the format + // `projects/*/locations/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Optional. Limit on the number of [CertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthority] to + // include in the response. + // Further [CertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthority] can subsequently be + // obtained by including the + // [ListCertificateAuthoritiesResponse.next_page_token][google.cloud.security.privateca.v1beta1.ListCertificateAuthoritiesResponse.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. Pagination token, returned earlier via + // [ListCertificateAuthoritiesResponse.next_page_token][google.cloud.security.privateca.v1beta1.ListCertificateAuthoritiesResponse.next_page_token]. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Only include resources that match the filter in the response. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specify how the results should be sorted. + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for +// [CertificateAuthorityService.ListCertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificateAuthorities]. +message ListCertificateAuthoritiesResponse { + // The list of [CertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + repeated CertificateAuthority certificate_authorities = 1; + + // A token to retrieve next page of results. Pass this value in + // [ListCertificateAuthoritiesRequest.next_page_token][] to retrieve the next + // page of results. + string next_page_token = 2; + + // A list of locations (e.g. "us-west1") that could not be reached. + repeated string unreachable = 3; +} + +// Request message for +// [CertificateAuthorityService.RestoreCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.RestoreCertificateAuthority]. +message RestoreCertificateAuthorityRequest { + // Required. The resource name for this [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] in the + // format `projects/*/locations/*/certificateAuthorities/*`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "privateca.googleapis.com/CertificateAuthority" + } + ]; + + // Optional. An ID to identify requests. Specify a unique request ID so that if you must + // retry your request, the server will know to ignore the request if it has + // already been completed. The server will guarantee that for at least 60 + // minutes since the first request. + // + // For example, consider a situation where you make an initial request and t + // he request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [CertificateAuthorityService.ScheduleDeleteCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ScheduleDeleteCertificateAuthority]. +message ScheduleDeleteCertificateAuthorityRequest { + // Required. The resource name for this [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] in the + // format `projects/*/locations/*/certificateAuthorities/*`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "privateca.googleapis.com/CertificateAuthority" + } + ]; + + // Optional. An ID to identify requests. Specify a unique request ID so that if you must + // retry your request, the server will know to ignore the request if it has + // already been completed. The server will guarantee that for at least 60 + // minutes since the first request. + // + // For example, consider a situation where you make an initial request and t + // he request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [CertificateAuthorityService.UpdateCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.UpdateCertificateAuthority]. +message UpdateCertificateAuthorityRequest { + // Required. [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] with updated values. + CertificateAuthority certificate_authority = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. A list of fields to be updated in this request. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An ID to identify requests. Specify a unique request ID so that if you must + // retry your request, the server will know to ignore the request if it has + // already been completed. The server will guarantee that for at least 60 + // minutes since the first request. + // + // For example, consider a situation where you make an initial request and t + // he request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [CertificateAuthorityService.GetCertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetCertificateRevocationList]. +message GetCertificateRevocationListRequest { + // Required. The [name][google.cloud.security.privateca.v1beta1.CertificateRevocationList.name] of the + // [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList] to get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "privateca.googleapis.com/CertificateRevocationList" + } + ]; +} + +// Request message for +// [CertificateAuthorityService.ListCertificateRevocationLists][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificateRevocationLists]. +message ListCertificateRevocationListsRequest { + // Required. The resource name of the location associated with the + // [CertificateRevocationLists][google.cloud.security.privateca.v1beta1.CertificateRevocationList], in the format + // `projects/*/locations/*/certificateauthorities/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "privateca.googleapis.com/CertificateAuthority" + } + ]; + + // Optional. Limit on the number of + // [CertificateRevocationLists][google.cloud.security.privateca.v1beta1.CertificateRevocationList] to include in the + // response. Further [CertificateRevocationLists][google.cloud.security.privateca.v1beta1.CertificateRevocationList] + // can subsequently be obtained by including the + // [ListCertificateRevocationListsResponse.next_page_token][google.cloud.security.privateca.v1beta1.ListCertificateRevocationListsResponse.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. Pagination token, returned earlier via + // [ListCertificateRevocationListsResponse.next_page_token][google.cloud.security.privateca.v1beta1.ListCertificateRevocationListsResponse.next_page_token]. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Only include resources that match the filter in the response. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specify how the results should be sorted. + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for +// [CertificateAuthorityService.ListCertificateRevocationLists][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificateRevocationLists]. +message ListCertificateRevocationListsResponse { + // The list of [CertificateRevocationLists][google.cloud.security.privateca.v1beta1.CertificateRevocationList]. + repeated CertificateRevocationList certificate_revocation_lists = 1; + + // A token to retrieve next page of results. Pass this value in + // [ListCertificateRevocationListsRequest.next_page_token][] to retrieve the + // next page of results. + string next_page_token = 2; + + // A list of locations (e.g. "us-west1") that could not be reached. + repeated string unreachable = 3; +} + +// Request message for +// [CertificateAuthorityService.UpdateCertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.UpdateCertificateRevocationList]. +message UpdateCertificateRevocationListRequest { + // Required. [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList] with updated values. + CertificateRevocationList certificate_revocation_list = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. A list of fields to be updated in this request. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An ID to identify requests. Specify a unique request ID so that if you must + // retry your request, the server will know to ignore the request if it has + // already been completed. The server will guarantee that for at least 60 + // minutes since the first request. + // + // For example, consider a situation where you make an initial request and t + // he request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [CertificateAuthorityService.GetReusableConfig][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetReusableConfig]. +message GetReusableConfigRequest { + // Required. The [name][ReusableConfigs.name] of the [ReusableConfigs][] to get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "privateca.googleapis.com/ReusableConfig" + } + ]; +} + +// Request message for +// [CertificateAuthorityService.ListReusableConfigs][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListReusableConfigs]. +message ListReusableConfigsRequest { + // Required. The resource name of the location associated with the + // [ReusableConfigs][google.cloud.security.privateca.v1beta1.ReusableConfig], in the format + // `projects/*/locations/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Optional. Limit on the number of + // [ReusableConfigs][google.cloud.security.privateca.v1beta1.ReusableConfig] to include in the response. + // Further [ReusableConfigs][google.cloud.security.privateca.v1beta1.ReusableConfig] can subsequently be + // obtained by including the + // [ListReusableConfigsResponse.next_page_token][google.cloud.security.privateca.v1beta1.ListReusableConfigsResponse.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. Pagination token, returned earlier via + // [ListReusableConfigsResponse.next_page_token][google.cloud.security.privateca.v1beta1.ListReusableConfigsResponse.next_page_token]. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Only include resources that match the filter in the response. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specify how the results should be sorted. + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for +// [CertificateAuthorityService.ListReusableConfigs][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListReusableConfigs]. +message ListReusableConfigsResponse { + // The list of [ReusableConfigs][google.cloud.security.privateca.v1beta1.ReusableConfig]. + repeated ReusableConfig reusable_configs = 1; + + // A token to retrieve next page of results. Pass this value in + // [ListReusableConfigsRequest.next_page_token][] to retrieve + // the next page of results. + string next_page_token = 2; + + // A list of locations (e.g. "us-west1") that could not be reached. + repeated string unreachable = 3; +} + +// Represents the metadata of the long-running operation. +message OperationMetadata { + // Output only. The time the operation was created. + google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the operation finished running. + google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Server-defined resource path for the target of the operation. + string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Name of the verb executed by the operation. + string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Human-readable status of the operation, if any. + string status_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Identifies whether the user has requested cancellation + // of the operation. Operations that have successfully been cancelled + // have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, + // corresponding to `Code.CANCELLED`. + bool requested_cancellation = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. API version used to start the operation. + string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.activate_certificate_authority.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.activate_certificate_authority.js new file mode 100644 index 0000000..70d2932 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.activate_certificate_authority.js @@ -0,0 +1,86 @@ +// 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, pemCaCertificate, subordinateConfig) { + // [START privateca_v1beta1_generated_CertificateAuthorityService_ActivateCertificateAuthority_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name for this CertificateAuthority google.cloud.security.privateca.v1beta1.CertificateAuthority in the + * format `projects/* /locations/* /certificateAuthorities/*`. + */ + // const name = 'abc123' + /** + * Required. The signed CA certificate issued from + * FetchCertificateAuthorityCsrResponse.pem_csr google.cloud.security.privateca.v1beta1.FetchCertificateAuthorityCsrResponse.pem_csr. + */ + // const pemCaCertificate = 'abc123' + /** + * Required. Must include information about the issuer of 'pem_ca_certificate', and any + * further issuers until the self-signed CA. + */ + // const subordinateConfig = {} + /** + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Privateca library + const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1beta1; + + // Instantiates a client + const privatecaClient = new CertificateAuthorityServiceClient(); + + async function callActivateCertificateAuthority() { + // Construct request + const request = { + name, + pemCaCertificate, + subordinateConfig, + }; + + // Run request + const [operation] = await privatecaClient.activateCertificateAuthority(request); + const [response] = await operation.promise(); + console.log(response); + } + + callActivateCertificateAuthority(); + // [END privateca_v1beta1_generated_CertificateAuthorityService_ActivateCertificateAuthority_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.create_certificate.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.create_certificate.js new file mode 100644 index 0000000..df83e0f --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.create_certificate.js @@ -0,0 +1,86 @@ +// 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, certificate) { + // [START privateca_v1beta1_generated_CertificateAuthorityService_CreateCertificate_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the location and CertificateAuthority google.cloud.security.privateca.v1beta1.CertificateAuthority + * associated with the Certificate google.cloud.security.privateca.v1beta1.Certificate, in the format + * `projects/* /locations/* /certificateAuthorities/*`. + */ + // const parent = 'abc123' + /** + * Optional. It must be unique within a location and match the regular + * expression `[a-zA-Z0-9_-]{1,63}`. This field is required when using a + * CertificateAuthority google.cloud.security.privateca.v1beta1.CertificateAuthority in the Enterprise CertificateAuthority.Tier google.cloud.security.privateca.v1beta1.CertificateAuthority.Tier, + * but is optional and its value is ignored otherwise. + */ + // const certificateId = 'abc123' + /** + * Required. A Certificate google.cloud.security.privateca.v1beta1.Certificate with initial field values. + */ + // const certificate = {} + /** + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Privateca library + const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1beta1; + + // Instantiates a client + const privatecaClient = new CertificateAuthorityServiceClient(); + + async function callCreateCertificate() { + // Construct request + const request = { + parent, + certificate, + }; + + // Run request + const response = await privatecaClient.createCertificate(request); + console.log(response); + } + + callCreateCertificate(); + // [END privateca_v1beta1_generated_CertificateAuthorityService_CreateCertificate_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.create_certificate_authority.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.create_certificate_authority.js new file mode 100644 index 0000000..eafbbda --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.create_certificate_authority.js @@ -0,0 +1,86 @@ +// 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, certificateAuthorityId, certificateAuthority) { + // [START privateca_v1beta1_generated_CertificateAuthorityService_CreateCertificateAuthority_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the location associated with the + * CertificateAuthorities google.cloud.security.privateca.v1beta1.CertificateAuthority, 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 certificateAuthorityId = 'abc123' + /** + * Required. A CertificateAuthority google.cloud.security.privateca.v1beta1.CertificateAuthority with initial field values. + */ + // const certificateAuthority = {} + /** + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Privateca library + const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1beta1; + + // Instantiates a client + const privatecaClient = new CertificateAuthorityServiceClient(); + + async function callCreateCertificateAuthority() { + // Construct request + const request = { + parent, + certificateAuthorityId, + certificateAuthority, + }; + + // Run request + const [operation] = await privatecaClient.createCertificateAuthority(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateCertificateAuthority(); + // [END privateca_v1beta1_generated_CertificateAuthorityService_CreateCertificateAuthority_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.disable_certificate_authority.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.disable_certificate_authority.js new file mode 100644 index 0000000..8f61656 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.disable_certificate_authority.js @@ -0,0 +1,74 @@ +// 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 privateca_v1beta1_generated_CertificateAuthorityService_DisableCertificateAuthority_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name for this CertificateAuthority google.cloud.security.privateca.v1beta1.CertificateAuthority in the + * format `projects/* /locations/* /certificateAuthorities/*`. + */ + // const name = 'abc123' + /** + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Privateca library + const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1beta1; + + // Instantiates a client + const privatecaClient = new CertificateAuthorityServiceClient(); + + async function callDisableCertificateAuthority() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await privatecaClient.disableCertificateAuthority(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDisableCertificateAuthority(); + // [END privateca_v1beta1_generated_CertificateAuthorityService_DisableCertificateAuthority_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.enable_certificate_authority.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.enable_certificate_authority.js new file mode 100644 index 0000000..d6e053a --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.enable_certificate_authority.js @@ -0,0 +1,74 @@ +// 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 privateca_v1beta1_generated_CertificateAuthorityService_EnableCertificateAuthority_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name for this CertificateAuthority google.cloud.security.privateca.v1beta1.CertificateAuthority in the + * format `projects/* /locations/* /certificateAuthorities/*`. + */ + // const name = 'abc123' + /** + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Privateca library + const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1beta1; + + // Instantiates a client + const privatecaClient = new CertificateAuthorityServiceClient(); + + async function callEnableCertificateAuthority() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await privatecaClient.enableCertificateAuthority(request); + const [response] = await operation.promise(); + console.log(response); + } + + callEnableCertificateAuthority(); + // [END privateca_v1beta1_generated_CertificateAuthorityService_EnableCertificateAuthority_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.fetch_certificate_authority_csr.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.fetch_certificate_authority_csr.js new file mode 100644 index 0000000..f4a09ff --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.fetch_certificate_authority_csr.js @@ -0,0 +1,59 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START privateca_v1beta1_generated_CertificateAuthorityService_FetchCertificateAuthorityCsr_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name for this CertificateAuthority google.cloud.security.privateca.v1beta1.CertificateAuthority in the + * format `projects/* /locations/* /certificateAuthorities/*`. + */ + // const name = 'abc123' + + // Imports the Privateca library + const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1beta1; + + // Instantiates a client + const privatecaClient = new CertificateAuthorityServiceClient(); + + async function callFetchCertificateAuthorityCsr() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await privatecaClient.fetchCertificateAuthorityCsr(request); + console.log(response); + } + + callFetchCertificateAuthorityCsr(); + // [END privateca_v1beta1_generated_CertificateAuthorityService_FetchCertificateAuthorityCsr_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.get_certificate.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.get_certificate.js new file mode 100644 index 0000000..7bdaefb --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.get_certificate.js @@ -0,0 +1,58 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START privateca_v1beta1_generated_CertificateAuthorityService_GetCertificate_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name google.cloud.security.privateca.v1beta1.Certificate.name of the Certificate google.cloud.security.privateca.v1beta1.Certificate to get. + */ + // const name = 'abc123' + + // Imports the Privateca library + const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1beta1; + + // Instantiates a client + const privatecaClient = new CertificateAuthorityServiceClient(); + + async function callGetCertificate() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await privatecaClient.getCertificate(request); + console.log(response); + } + + callGetCertificate(); + // [END privateca_v1beta1_generated_CertificateAuthorityService_GetCertificate_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.get_certificate_authority.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.get_certificate_authority.js new file mode 100644 index 0000000..0f0642d --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.get_certificate_authority.js @@ -0,0 +1,59 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START privateca_v1beta1_generated_CertificateAuthorityService_GetCertificateAuthority_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name google.cloud.security.privateca.v1beta1.CertificateAuthority.name of the CertificateAuthority google.cloud.security.privateca.v1beta1.CertificateAuthority to + * get. + */ + // const name = 'abc123' + + // Imports the Privateca library + const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1beta1; + + // Instantiates a client + const privatecaClient = new CertificateAuthorityServiceClient(); + + async function callGetCertificateAuthority() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await privatecaClient.getCertificateAuthority(request); + console.log(response); + } + + callGetCertificateAuthority(); + // [END privateca_v1beta1_generated_CertificateAuthorityService_GetCertificateAuthority_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.get_certificate_revocation_list.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.get_certificate_revocation_list.js new file mode 100644 index 0000000..4e3aa98 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.get_certificate_revocation_list.js @@ -0,0 +1,59 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START privateca_v1beta1_generated_CertificateAuthorityService_GetCertificateRevocationList_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name google.cloud.security.privateca.v1beta1.CertificateRevocationList.name of the + * CertificateRevocationList google.cloud.security.privateca.v1beta1.CertificateRevocationList to get. + */ + // const name = 'abc123' + + // Imports the Privateca library + const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1beta1; + + // Instantiates a client + const privatecaClient = new CertificateAuthorityServiceClient(); + + async function callGetCertificateRevocationList() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await privatecaClient.getCertificateRevocationList(request); + console.log(response); + } + + callGetCertificateRevocationList(); + // [END privateca_v1beta1_generated_CertificateAuthorityService_GetCertificateRevocationList_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.get_reusable_config.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.get_reusable_config.js new file mode 100644 index 0000000..52caa32 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.get_reusable_config.js @@ -0,0 +1,58 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START privateca_v1beta1_generated_CertificateAuthorityService_GetReusableConfig_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name ReusableConfigs.name of the ReusableConfigs to get. + */ + // const name = 'abc123' + + // Imports the Privateca library + const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1beta1; + + // Instantiates a client + const privatecaClient = new CertificateAuthorityServiceClient(); + + async function callGetReusableConfig() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await privatecaClient.getReusableConfig(request); + console.log(response); + } + + callGetReusableConfig(); + // [END privateca_v1beta1_generated_CertificateAuthorityService_GetReusableConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.list_certificate_authorities.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.list_certificate_authorities.js new file mode 100644 index 0000000..73c847e --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.list_certificate_authorities.js @@ -0,0 +1,84 @@ +// 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 privateca_v1beta1_generated_CertificateAuthorityService_ListCertificateAuthorities_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the location associated with the + * CertificateAuthorities google.cloud.security.privateca.v1beta1.CertificateAuthority, in the format + * `projects/* /locations/*`. + */ + // const parent = 'abc123' + /** + * Optional. Limit on the number of CertificateAuthorities google.cloud.security.privateca.v1beta1.CertificateAuthority to + * include in the response. + * Further CertificateAuthorities google.cloud.security.privateca.v1beta1.CertificateAuthority can subsequently be + * obtained by including the + * ListCertificateAuthoritiesResponse.next_page_token google.cloud.security.privateca.v1beta1.ListCertificateAuthoritiesResponse.next_page_token in a subsequent + * request. If unspecified, the server will pick an appropriate default. + */ + // const pageSize = 1234 + /** + * Optional. Pagination token, returned earlier via + * ListCertificateAuthoritiesResponse.next_page_token google.cloud.security.privateca.v1beta1.ListCertificateAuthoritiesResponse.next_page_token. + */ + // const pageToken = 'abc123' + /** + * Optional. Only include resources that match the filter in the response. + */ + // const filter = 'abc123' + /** + * Optional. Specify how the results should be sorted. + */ + // const orderBy = 'abc123' + + // Imports the Privateca library + const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1beta1; + + // Instantiates a client + const privatecaClient = new CertificateAuthorityServiceClient(); + + async function callListCertificateAuthorities() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await privatecaClient.listCertificateAuthoritiesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListCertificateAuthorities(); + // [END privateca_v1beta1_generated_CertificateAuthorityService_ListCertificateAuthorities_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.list_certificate_revocation_lists.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.list_certificate_revocation_lists.js new file mode 100644 index 0000000..c101c2e --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.list_certificate_revocation_lists.js @@ -0,0 +1,84 @@ +// 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 privateca_v1beta1_generated_CertificateAuthorityService_ListCertificateRevocationLists_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the location associated with the + * CertificateRevocationLists google.cloud.security.privateca.v1beta1.CertificateRevocationList, in the format + * `projects/* /locations/* /certificateauthorities/*`. + */ + // const parent = 'abc123' + /** + * Optional. Limit on the number of + * CertificateRevocationLists google.cloud.security.privateca.v1beta1.CertificateRevocationList to include in the + * response. Further CertificateRevocationLists google.cloud.security.privateca.v1beta1.CertificateRevocationList + * can subsequently be obtained by including the + * ListCertificateRevocationListsResponse.next_page_token google.cloud.security.privateca.v1beta1.ListCertificateRevocationListsResponse.next_page_token in a subsequent + * request. If unspecified, the server will pick an appropriate default. + */ + // const pageSize = 1234 + /** + * Optional. Pagination token, returned earlier via + * ListCertificateRevocationListsResponse.next_page_token google.cloud.security.privateca.v1beta1.ListCertificateRevocationListsResponse.next_page_token. + */ + // const pageToken = 'abc123' + /** + * Optional. Only include resources that match the filter in the response. + */ + // const filter = 'abc123' + /** + * Optional. Specify how the results should be sorted. + */ + // const orderBy = 'abc123' + + // Imports the Privateca library + const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1beta1; + + // Instantiates a client + const privatecaClient = new CertificateAuthorityServiceClient(); + + async function callListCertificateRevocationLists() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await privatecaClient.listCertificateRevocationListsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListCertificateRevocationLists(); + // [END privateca_v1beta1_generated_CertificateAuthorityService_ListCertificateRevocationLists_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.list_certificates.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.list_certificates.js new file mode 100644 index 0000000..81c7c01 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.list_certificates.js @@ -0,0 +1,88 @@ +// 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 privateca_v1beta1_generated_CertificateAuthorityService_ListCertificates_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the location associated with the + * Certificates google.cloud.security.privateca.v1beta1.Certificate, in the format + * `projects/* /locations/* /certificateauthorities/*`. + */ + // const parent = 'abc123' + /** + * Optional. Limit on the number of + * Certificates google.cloud.security.privateca.v1beta1.Certificate to include in the + * response. Further Certificates google.cloud.security.privateca.v1beta1.Certificate can subsequently be obtained + * by including the + * ListCertificatesResponse.next_page_token google.cloud.security.privateca.v1beta1.ListCertificatesResponse.next_page_token in a subsequent + * request. If unspecified, the server will pick an appropriate default. + */ + // const pageSize = 1234 + /** + * Optional. Pagination token, returned earlier via + * ListCertificatesResponse.next_page_token google.cloud.security.privateca.v1beta1.ListCertificatesResponse.next_page_token. + */ + // const pageToken = 'abc123' + /** + * Optional. Only include resources that match the filter in the response. For details + * on supported filters and syntax, see Certificates Filtering + * documentation (https://cloud.google.com/certificate-authority-service/docs/sorting-filtering-certificates#filtering_support). + */ + // const filter = 'abc123' + /** + * Optional. Specify how the results should be sorted. For details on supported fields + * and syntax, see Certificates Sorting + * documentation (https://cloud.google.com/certificate-authority-service/docs/sorting-filtering-certificates#sorting_support). + */ + // const orderBy = 'abc123' + + // Imports the Privateca library + const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1beta1; + + // Instantiates a client + const privatecaClient = new CertificateAuthorityServiceClient(); + + async function callListCertificates() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await privatecaClient.listCertificatesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListCertificates(); + // [END privateca_v1beta1_generated_CertificateAuthorityService_ListCertificates_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.list_reusable_configs.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.list_reusable_configs.js new file mode 100644 index 0000000..479948d --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.list_reusable_configs.js @@ -0,0 +1,84 @@ +// 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 privateca_v1beta1_generated_CertificateAuthorityService_ListReusableConfigs_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the location associated with the + * ReusableConfigs google.cloud.security.privateca.v1beta1.ReusableConfig, in the format + * `projects/* /locations/*`. + */ + // const parent = 'abc123' + /** + * Optional. Limit on the number of + * ReusableConfigs google.cloud.security.privateca.v1beta1.ReusableConfig to include in the response. + * Further ReusableConfigs google.cloud.security.privateca.v1beta1.ReusableConfig can subsequently be + * obtained by including the + * ListReusableConfigsResponse.next_page_token google.cloud.security.privateca.v1beta1.ListReusableConfigsResponse.next_page_token in a subsequent request. If + * unspecified, the server will pick an appropriate default. + */ + // const pageSize = 1234 + /** + * Optional. Pagination token, returned earlier via + * ListReusableConfigsResponse.next_page_token google.cloud.security.privateca.v1beta1.ListReusableConfigsResponse.next_page_token. + */ + // const pageToken = 'abc123' + /** + * Optional. Only include resources that match the filter in the response. + */ + // const filter = 'abc123' + /** + * Optional. Specify how the results should be sorted. + */ + // const orderBy = 'abc123' + + // Imports the Privateca library + const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1beta1; + + // Instantiates a client + const privatecaClient = new CertificateAuthorityServiceClient(); + + async function callListReusableConfigs() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await privatecaClient.listReusableConfigsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListReusableConfigs(); + // [END privateca_v1beta1_generated_CertificateAuthorityService_ListReusableConfigs_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.restore_certificate_authority.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.restore_certificate_authority.js new file mode 100644 index 0000000..a6191a2 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.restore_certificate_authority.js @@ -0,0 +1,74 @@ +// 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 privateca_v1beta1_generated_CertificateAuthorityService_RestoreCertificateAuthority_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name for this CertificateAuthority google.cloud.security.privateca.v1beta1.CertificateAuthority in the + * format `projects/* /locations/* /certificateAuthorities/*`. + */ + // const name = 'abc123' + /** + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Privateca library + const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1beta1; + + // Instantiates a client + const privatecaClient = new CertificateAuthorityServiceClient(); + + async function callRestoreCertificateAuthority() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await privatecaClient.restoreCertificateAuthority(request); + const [response] = await operation.promise(); + console.log(response); + } + + callRestoreCertificateAuthority(); + // [END privateca_v1beta1_generated_CertificateAuthorityService_RestoreCertificateAuthority_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.revoke_certificate.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.revoke_certificate.js new file mode 100644 index 0000000..de0e716 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.revoke_certificate.js @@ -0,0 +1,78 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name, reason) { + // [START privateca_v1beta1_generated_CertificateAuthorityService_RevokeCertificate_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name for this Certificate google.cloud.security.privateca.v1beta1.Certificate in the + * format `projects/* /locations/* /certificateAuthorities/* /certificates/*`. + */ + // const name = 'abc123' + /** + * Required. The RevocationReason google.cloud.security.privateca.v1beta1.RevocationReason for revoking this certificate. + */ + // const reason = {} + /** + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Privateca library + const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1beta1; + + // Instantiates a client + const privatecaClient = new CertificateAuthorityServiceClient(); + + async function callRevokeCertificate() { + // Construct request + const request = { + name, + reason, + }; + + // Run request + const response = await privatecaClient.revokeCertificate(request); + console.log(response); + } + + callRevokeCertificate(); + // [END privateca_v1beta1_generated_CertificateAuthorityService_RevokeCertificate_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.schedule_delete_certificate_authority.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.schedule_delete_certificate_authority.js new file mode 100644 index 0000000..22379e2 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.schedule_delete_certificate_authority.js @@ -0,0 +1,74 @@ +// 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 privateca_v1beta1_generated_CertificateAuthorityService_ScheduleDeleteCertificateAuthority_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name for this CertificateAuthority google.cloud.security.privateca.v1beta1.CertificateAuthority in the + * format `projects/* /locations/* /certificateAuthorities/*`. + */ + // const name = 'abc123' + /** + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Privateca library + const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1beta1; + + // Instantiates a client + const privatecaClient = new CertificateAuthorityServiceClient(); + + async function callScheduleDeleteCertificateAuthority() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await privatecaClient.scheduleDeleteCertificateAuthority(request); + const [response] = await operation.promise(); + console.log(response); + } + + callScheduleDeleteCertificateAuthority(); + // [END privateca_v1beta1_generated_CertificateAuthorityService_ScheduleDeleteCertificateAuthority_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.update_certificate.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.update_certificate.js new file mode 100644 index 0000000..faa3660 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.update_certificate.js @@ -0,0 +1,77 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(certificate, updateMask) { + // [START privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificate_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Certificate google.cloud.security.privateca.v1beta1.Certificate with updated values. + */ + // const certificate = {} + /** + * Required. A list of fields to be updated in this request. + */ + // const updateMask = {} + /** + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Privateca library + const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1beta1; + + // Instantiates a client + const privatecaClient = new CertificateAuthorityServiceClient(); + + async function callUpdateCertificate() { + // Construct request + const request = { + certificate, + updateMask, + }; + + // Run request + const response = await privatecaClient.updateCertificate(request); + console.log(response); + } + + callUpdateCertificate(); + // [END privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificate_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.update_certificate_authority.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.update_certificate_authority.js new file mode 100644 index 0000000..bc47053 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.update_certificate_authority.js @@ -0,0 +1,78 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(certificateAuthority, updateMask) { + // [START privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificateAuthority_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. CertificateAuthority google.cloud.security.privateca.v1beta1.CertificateAuthority with updated values. + */ + // const certificateAuthority = {} + /** + * Required. A list of fields to be updated in this request. + */ + // const updateMask = {} + /** + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Privateca library + const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1beta1; + + // Instantiates a client + const privatecaClient = new CertificateAuthorityServiceClient(); + + async function callUpdateCertificateAuthority() { + // Construct request + const request = { + certificateAuthority, + updateMask, + }; + + // Run request + const [operation] = await privatecaClient.updateCertificateAuthority(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateCertificateAuthority(); + // [END privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificateAuthority_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.update_certificate_revocation_list.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.update_certificate_revocation_list.js new file mode 100644 index 0000000..44d5edb --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.update_certificate_revocation_list.js @@ -0,0 +1,78 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(certificateRevocationList, updateMask) { + // [START privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificateRevocationList_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. CertificateRevocationList google.cloud.security.privateca.v1beta1.CertificateRevocationList with updated values. + */ + // const certificateRevocationList = {} + /** + * Required. A list of fields to be updated in this request. + */ + // const updateMask = {} + /** + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Privateca library + const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1beta1; + + // Instantiates a client + const privatecaClient = new CertificateAuthorityServiceClient(); + + async function callUpdateCertificateRevocationList() { + // Construct request + const request = { + certificateRevocationList, + updateMask, + }; + + // Run request + const [operation] = await privatecaClient.updateCertificateRevocationList(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateCertificateRevocationList(); + // [END privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificateRevocationList_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.security.privateca.v1beta1.json b/owl-bot-staging/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.security.privateca.v1beta1.json new file mode 100644 index 0000000..d9d2e45 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.security.privateca.v1beta1.json @@ -0,0 +1,963 @@ +{ + "clientLibrary": { + "name": "nodejs-privateca", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.security.privateca.v1beta1", + "version": "v1beta1" + } + ] + }, + "snippets": [ + { + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_CreateCertificate_async", + "title": "CertificateAuthorityService createCertificate Sample", + "origin": "API_DEFINITION", + "description": " Create a new [Certificate][google.cloud.security.privateca.v1beta1.Certificate] in a given Project, Location from a particular [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority].", + "canonical": true, + "file": "certificate_authority_service.create_certificate.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateCertificate", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.CreateCertificate", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "certificate_id", + "type": "TYPE_STRING" + }, + { + "name": "certificate", + "type": ".google.cloud.security.privateca.v1beta1.Certificate" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.security.privateca.v1beta1.Certificate", + "client": { + "shortName": "CertificateAuthorityServiceClient", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient" + }, + "method": { + "shortName": "CreateCertificate", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.CreateCertificate", + "service": { + "shortName": "CertificateAuthorityService", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService" + } + } + } + }, + { + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_GetCertificate_async", + "title": "CertificateAuthorityService getCertificate Sample", + "origin": "API_DEFINITION", + "description": " Returns a [Certificate][google.cloud.security.privateca.v1beta1.Certificate].", + "canonical": true, + "file": "certificate_authority_service.get_certificate.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 50, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetCertificate", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetCertificate", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.security.privateca.v1beta1.Certificate", + "client": { + "shortName": "CertificateAuthorityServiceClient", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient" + }, + "method": { + "shortName": "GetCertificate", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetCertificate", + "service": { + "shortName": "CertificateAuthorityService", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService" + } + } + } + }, + { + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_ListCertificates_async", + "title": "CertificateAuthorityService listCertificates Sample", + "origin": "API_DEFINITION", + "description": " Lists [Certificates][google.cloud.security.privateca.v1beta1.Certificate].", + "canonical": true, + "file": "certificate_authority_service.list_certificates.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 80, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListCertificates", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificates", + "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.security.privateca.v1beta1.ListCertificatesResponse", + "client": { + "shortName": "CertificateAuthorityServiceClient", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient" + }, + "method": { + "shortName": "ListCertificates", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificates", + "service": { + "shortName": "CertificateAuthorityService", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService" + } + } + } + }, + { + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_RevokeCertificate_async", + "title": "CertificateAuthorityService revokeCertificate Sample", + "origin": "API_DEFINITION", + "description": " Revoke a [Certificate][google.cloud.security.privateca.v1beta1.Certificate].", + "canonical": true, + "file": "certificate_authority_service.revoke_certificate.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 70, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RevokeCertificate", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.RevokeCertificate", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "reason", + "type": ".google.cloud.security.privateca.v1beta1.RevocationReason" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.security.privateca.v1beta1.Certificate", + "client": { + "shortName": "CertificateAuthorityServiceClient", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient" + }, + "method": { + "shortName": "RevokeCertificate", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.RevokeCertificate", + "service": { + "shortName": "CertificateAuthorityService", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService" + } + } + } + }, + { + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificate_async", + "title": "CertificateAuthorityService updateCertificate Sample", + "origin": "API_DEFINITION", + "description": " Update a [Certificate][google.cloud.security.privateca.v1beta1.Certificate]. Currently, the only field you can update is the [labels][google.cloud.security.privateca.v1beta1.Certificate.labels] field.", + "canonical": true, + "file": "certificate_authority_service.update_certificate.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateCertificate", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.UpdateCertificate", + "async": true, + "parameters": [ + { + "name": "certificate", + "type": ".google.cloud.security.privateca.v1beta1.Certificate" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.security.privateca.v1beta1.Certificate", + "client": { + "shortName": "CertificateAuthorityServiceClient", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient" + }, + "method": { + "shortName": "UpdateCertificate", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.UpdateCertificate", + "service": { + "shortName": "CertificateAuthorityService", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService" + } + } + } + }, + { + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_ActivateCertificateAuthority_async", + "title": "CertificateAuthorityService activateCertificateAuthority Sample", + "origin": "API_DEFINITION", + "description": " Activate a [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] that is in state [PENDING_ACTIVATION][google.cloud.security.privateca.v1beta1.CertificateAuthority.State.PENDING_ACTIVATION] and is of type [SUBORDINATE][google.cloud.security.privateca.v1beta1.CertificateAuthority.Type.SUBORDINATE]. After the parent Certificate Authority signs a certificate signing request from [FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.FetchCertificateAuthorityCsr], this method can complete the activation process.", + "canonical": true, + "file": "certificate_authority_service.activate_certificate_authority.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ActivateCertificateAuthority", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ActivateCertificateAuthority", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "pem_ca_certificate", + "type": "TYPE_STRING" + }, + { + "name": "subordinate_config", + "type": ".google.cloud.security.privateca.v1beta1.SubordinateConfig" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CertificateAuthorityServiceClient", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient" + }, + "method": { + "shortName": "ActivateCertificateAuthority", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ActivateCertificateAuthority", + "service": { + "shortName": "CertificateAuthorityService", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService" + } + } + } + }, + { + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_CreateCertificateAuthority_async", + "title": "CertificateAuthorityService createCertificateAuthority Sample", + "origin": "API_DEFINITION", + "description": " Create a new [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] in a given Project and Location.", + "canonical": true, + "file": "certificate_authority_service.create_certificate_authority.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateCertificateAuthority", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.CreateCertificateAuthority", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "certificate_authority_id", + "type": "TYPE_STRING" + }, + { + "name": "certificate_authority", + "type": ".google.cloud.security.privateca.v1beta1.CertificateAuthority" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CertificateAuthorityServiceClient", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient" + }, + "method": { + "shortName": "CreateCertificateAuthority", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.CreateCertificateAuthority", + "service": { + "shortName": "CertificateAuthorityService", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService" + } + } + } + }, + { + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_DisableCertificateAuthority_async", + "title": "CertificateAuthorityService disableCertificateAuthority Sample", + "origin": "API_DEFINITION", + "description": " Disable a [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority].", + "canonical": true, + "file": "certificate_authority_service.disable_certificate_authority.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DisableCertificateAuthority", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.DisableCertificateAuthority", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CertificateAuthorityServiceClient", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient" + }, + "method": { + "shortName": "DisableCertificateAuthority", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.DisableCertificateAuthority", + "service": { + "shortName": "CertificateAuthorityService", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService" + } + } + } + }, + { + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_EnableCertificateAuthority_async", + "title": "CertificateAuthorityService enableCertificateAuthority Sample", + "origin": "API_DEFINITION", + "description": " Enable a [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority].", + "canonical": true, + "file": "certificate_authority_service.enable_certificate_authority.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "EnableCertificateAuthority", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.EnableCertificateAuthority", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CertificateAuthorityServiceClient", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient" + }, + "method": { + "shortName": "EnableCertificateAuthority", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.EnableCertificateAuthority", + "service": { + "shortName": "CertificateAuthorityService", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService" + } + } + } + }, + { + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_FetchCertificateAuthorityCsr_async", + "title": "CertificateAuthorityService fetchCertificateAuthorityCsr Sample", + "origin": "API_DEFINITION", + "description": " Fetch a certificate signing request (CSR) from a [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] that is in state [PENDING_ACTIVATION][google.cloud.security.privateca.v1beta1.CertificateAuthority.State.PENDING_ACTIVATION] and is of type [SUBORDINATE][google.cloud.security.privateca.v1beta1.CertificateAuthority.Type.SUBORDINATE]. The CSR must then be signed by the desired parent Certificate Authority, which could be another [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] resource, or could be an on-prem certificate authority. See also [ActivateCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ActivateCertificateAuthority].", + "canonical": true, + "file": "certificate_authority_service.fetch_certificate_authority_csr.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "FetchCertificateAuthorityCsr", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.FetchCertificateAuthorityCsr", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.security.privateca.v1beta1.FetchCertificateAuthorityCsrResponse", + "client": { + "shortName": "CertificateAuthorityServiceClient", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient" + }, + "method": { + "shortName": "FetchCertificateAuthorityCsr", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.FetchCertificateAuthorityCsr", + "service": { + "shortName": "CertificateAuthorityService", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService" + } + } + } + }, + { + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_GetCertificateAuthority_async", + "title": "CertificateAuthorityService getCertificateAuthority Sample", + "origin": "API_DEFINITION", + "description": " Returns a [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority].", + "canonical": true, + "file": "certificate_authority_service.get_certificate_authority.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetCertificateAuthority", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetCertificateAuthority", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.security.privateca.v1beta1.CertificateAuthority", + "client": { + "shortName": "CertificateAuthorityServiceClient", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient" + }, + "method": { + "shortName": "GetCertificateAuthority", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetCertificateAuthority", + "service": { + "shortName": "CertificateAuthorityService", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService" + } + } + } + }, + { + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_ListCertificateAuthorities_async", + "title": "CertificateAuthorityService listCertificateAuthorities Sample", + "origin": "API_DEFINITION", + "description": " Lists [CertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthority].", + "canonical": true, + "file": "certificate_authority_service.list_certificate_authorities.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 76, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListCertificateAuthorities", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificateAuthorities", + "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.security.privateca.v1beta1.ListCertificateAuthoritiesResponse", + "client": { + "shortName": "CertificateAuthorityServiceClient", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient" + }, + "method": { + "shortName": "ListCertificateAuthorities", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificateAuthorities", + "service": { + "shortName": "CertificateAuthorityService", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService" + } + } + } + }, + { + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_RestoreCertificateAuthority_async", + "title": "CertificateAuthorityService restoreCertificateAuthority Sample", + "origin": "API_DEFINITION", + "description": " Restore a [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] that is scheduled for deletion.", + "canonical": true, + "file": "certificate_authority_service.restore_certificate_authority.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RestoreCertificateAuthority", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.RestoreCertificateAuthority", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CertificateAuthorityServiceClient", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient" + }, + "method": { + "shortName": "RestoreCertificateAuthority", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.RestoreCertificateAuthority", + "service": { + "shortName": "CertificateAuthorityService", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService" + } + } + } + }, + { + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_ScheduleDeleteCertificateAuthority_async", + "title": "CertificateAuthorityService scheduleDeleteCertificateAuthority Sample", + "origin": "API_DEFINITION", + "description": " Schedule a [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] for deletion.", + "canonical": true, + "file": "certificate_authority_service.schedule_delete_certificate_authority.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ScheduleDeleteCertificateAuthority", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ScheduleDeleteCertificateAuthority", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CertificateAuthorityServiceClient", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient" + }, + "method": { + "shortName": "ScheduleDeleteCertificateAuthority", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ScheduleDeleteCertificateAuthority", + "service": { + "shortName": "CertificateAuthorityService", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService" + } + } + } + }, + { + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificateAuthority_async", + "title": "CertificateAuthorityService updateCertificateAuthority Sample", + "origin": "API_DEFINITION", + "description": " Update a [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority].", + "canonical": true, + "file": "certificate_authority_service.update_certificate_authority.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 70, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateCertificateAuthority", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.UpdateCertificateAuthority", + "async": true, + "parameters": [ + { + "name": "certificate_authority", + "type": ".google.cloud.security.privateca.v1beta1.CertificateAuthority" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CertificateAuthorityServiceClient", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient" + }, + "method": { + "shortName": "UpdateCertificateAuthority", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.UpdateCertificateAuthority", + "service": { + "shortName": "CertificateAuthorityService", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService" + } + } + } + }, + { + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_GetCertificateRevocationList_async", + "title": "CertificateAuthorityService getCertificateRevocationList Sample", + "origin": "API_DEFINITION", + "description": " Returns a [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList].", + "canonical": true, + "file": "certificate_authority_service.get_certificate_revocation_list.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetCertificateRevocationList", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetCertificateRevocationList", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.security.privateca.v1beta1.CertificateRevocationList", + "client": { + "shortName": "CertificateAuthorityServiceClient", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient" + }, + "method": { + "shortName": "GetCertificateRevocationList", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetCertificateRevocationList", + "service": { + "shortName": "CertificateAuthorityService", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService" + } + } + } + }, + { + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_ListCertificateRevocationLists_async", + "title": "CertificateAuthorityService listCertificateRevocationLists Sample", + "origin": "API_DEFINITION", + "description": " Lists [CertificateRevocationLists][google.cloud.security.privateca.v1beta1.CertificateRevocationList].", + "canonical": true, + "file": "certificate_authority_service.list_certificate_revocation_lists.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 76, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListCertificateRevocationLists", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificateRevocationLists", + "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.security.privateca.v1beta1.ListCertificateRevocationListsResponse", + "client": { + "shortName": "CertificateAuthorityServiceClient", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient" + }, + "method": { + "shortName": "ListCertificateRevocationLists", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificateRevocationLists", + "service": { + "shortName": "CertificateAuthorityService", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService" + } + } + } + }, + { + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificateRevocationList_async", + "title": "CertificateAuthorityService updateCertificateRevocationList Sample", + "origin": "API_DEFINITION", + "description": " Update a [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList].", + "canonical": true, + "file": "certificate_authority_service.update_certificate_revocation_list.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 70, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateCertificateRevocationList", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.UpdateCertificateRevocationList", + "async": true, + "parameters": [ + { + "name": "certificate_revocation_list", + "type": ".google.cloud.security.privateca.v1beta1.CertificateRevocationList" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CertificateAuthorityServiceClient", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient" + }, + "method": { + "shortName": "UpdateCertificateRevocationList", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.UpdateCertificateRevocationList", + "service": { + "shortName": "CertificateAuthorityService", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService" + } + } + } + }, + { + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_GetReusableConfig_async", + "title": "CertificateAuthorityService getReusableConfig Sample", + "origin": "API_DEFINITION", + "description": " Returns a [ReusableConfig][google.cloud.security.privateca.v1beta1.ReusableConfig].", + "canonical": true, + "file": "certificate_authority_service.get_reusable_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 50, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetReusableConfig", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetReusableConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.security.privateca.v1beta1.ReusableConfig", + "client": { + "shortName": "CertificateAuthorityServiceClient", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient" + }, + "method": { + "shortName": "GetReusableConfig", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetReusableConfig", + "service": { + "shortName": "CertificateAuthorityService", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService" + } + } + } + }, + { + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_ListReusableConfigs_async", + "title": "CertificateAuthorityService listReusableConfigs Sample", + "origin": "API_DEFINITION", + "description": " Lists [ReusableConfigs][google.cloud.security.privateca.v1beta1.ReusableConfig].", + "canonical": true, + "file": "certificate_authority_service.list_reusable_configs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 76, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListReusableConfigs", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListReusableConfigs", + "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.security.privateca.v1beta1.ListReusableConfigsResponse", + "client": { + "shortName": "CertificateAuthorityServiceClient", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient" + }, + "method": { + "shortName": "ListReusableConfigs", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListReusableConfigs", + "service": { + "shortName": "CertificateAuthorityService", + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService" + } + } + } + } + ] +} diff --git a/owl-bot-staging/v1beta1/src/index.ts b/owl-bot-staging/v1beta1/src/index.ts new file mode 100644 index 0000000..915ad84 --- /dev/null +++ b/owl-bot-staging/v1beta1/src/index.ts @@ -0,0 +1,25 @@ +// 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 v1beta1 from './v1beta1'; +const CertificateAuthorityServiceClient = v1beta1.CertificateAuthorityServiceClient; +type CertificateAuthorityServiceClient = v1beta1.CertificateAuthorityServiceClient; +export {v1beta1, CertificateAuthorityServiceClient}; +export default {v1beta1, CertificateAuthorityServiceClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/v1beta1/src/v1beta1/certificate_authority_service_client.ts b/owl-bot-staging/v1beta1/src/v1beta1/certificate_authority_service_client.ts new file mode 100644 index 0000000..2343149 --- /dev/null +++ b/owl-bot-staging/v1beta1/src/v1beta1/certificate_authority_service_client.ts @@ -0,0 +1,3027 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1beta1/certificate_authority_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './certificate_authority_service_client_config.json'; +import { operationsProtos } from 'google-gax'; +const version = require('../../../package.json').version; + +/** + * {@link google.cloud.security.privateca.v1beta1.CertificateAuthorityService|Certificate Authority Service} manages private + * certificate authorities and issued certificates. + * @class + * @memberof v1beta1 + */ +export class CertificateAuthorityServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + certificateAuthorityServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of CertificateAuthorityServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof CertificateAuthorityServiceClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // 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 = { + certificatePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/certificateAuthorities/{certificate_authority}/certificates/{certificate}' + ), + certificateAuthorityPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/certificateAuthorities/{certificate_authority}' + ), + certificateRevocationListPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/certificateAuthorities/{certificate_authority}/certificateRevocationLists/{certificate_revocation_list}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + reusableConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/reusableConfigs/{reusable_config}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listCertificates: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'certificates'), + listCertificateAuthorities: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'certificateAuthorities'), + listCertificateRevocationLists: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'certificateRevocationLists'), + listReusableConfigs: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'reusableConfigs') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = []; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const activateCertificateAuthorityResponse = protoFilesRoot.lookup( + '.google.cloud.security.privateca.v1beta1.CertificateAuthority') as gax.protobuf.Type; + const activateCertificateAuthorityMetadata = protoFilesRoot.lookup( + '.google.cloud.security.privateca.v1beta1.OperationMetadata') as gax.protobuf.Type; + const createCertificateAuthorityResponse = protoFilesRoot.lookup( + '.google.cloud.security.privateca.v1beta1.CertificateAuthority') as gax.protobuf.Type; + const createCertificateAuthorityMetadata = protoFilesRoot.lookup( + '.google.cloud.security.privateca.v1beta1.OperationMetadata') as gax.protobuf.Type; + const disableCertificateAuthorityResponse = protoFilesRoot.lookup( + '.google.cloud.security.privateca.v1beta1.CertificateAuthority') as gax.protobuf.Type; + const disableCertificateAuthorityMetadata = protoFilesRoot.lookup( + '.google.cloud.security.privateca.v1beta1.OperationMetadata') as gax.protobuf.Type; + const enableCertificateAuthorityResponse = protoFilesRoot.lookup( + '.google.cloud.security.privateca.v1beta1.CertificateAuthority') as gax.protobuf.Type; + const enableCertificateAuthorityMetadata = protoFilesRoot.lookup( + '.google.cloud.security.privateca.v1beta1.OperationMetadata') as gax.protobuf.Type; + const restoreCertificateAuthorityResponse = protoFilesRoot.lookup( + '.google.cloud.security.privateca.v1beta1.CertificateAuthority') as gax.protobuf.Type; + const restoreCertificateAuthorityMetadata = protoFilesRoot.lookup( + '.google.cloud.security.privateca.v1beta1.OperationMetadata') as gax.protobuf.Type; + const scheduleDeleteCertificateAuthorityResponse = protoFilesRoot.lookup( + '.google.cloud.security.privateca.v1beta1.CertificateAuthority') as gax.protobuf.Type; + const scheduleDeleteCertificateAuthorityMetadata = protoFilesRoot.lookup( + '.google.cloud.security.privateca.v1beta1.OperationMetadata') as gax.protobuf.Type; + const updateCertificateAuthorityResponse = protoFilesRoot.lookup( + '.google.cloud.security.privateca.v1beta1.CertificateAuthority') as gax.protobuf.Type; + const updateCertificateAuthorityMetadata = protoFilesRoot.lookup( + '.google.cloud.security.privateca.v1beta1.OperationMetadata') as gax.protobuf.Type; + const updateCertificateRevocationListResponse = protoFilesRoot.lookup( + '.google.cloud.security.privateca.v1beta1.CertificateRevocationList') as gax.protobuf.Type; + const updateCertificateRevocationListMetadata = protoFilesRoot.lookup( + '.google.cloud.security.privateca.v1beta1.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + activateCertificateAuthority: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + activateCertificateAuthorityResponse.decode.bind(activateCertificateAuthorityResponse), + activateCertificateAuthorityMetadata.decode.bind(activateCertificateAuthorityMetadata)), + createCertificateAuthority: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createCertificateAuthorityResponse.decode.bind(createCertificateAuthorityResponse), + createCertificateAuthorityMetadata.decode.bind(createCertificateAuthorityMetadata)), + disableCertificateAuthority: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + disableCertificateAuthorityResponse.decode.bind(disableCertificateAuthorityResponse), + disableCertificateAuthorityMetadata.decode.bind(disableCertificateAuthorityMetadata)), + enableCertificateAuthority: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + enableCertificateAuthorityResponse.decode.bind(enableCertificateAuthorityResponse), + enableCertificateAuthorityMetadata.decode.bind(enableCertificateAuthorityMetadata)), + restoreCertificateAuthority: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + restoreCertificateAuthorityResponse.decode.bind(restoreCertificateAuthorityResponse), + restoreCertificateAuthorityMetadata.decode.bind(restoreCertificateAuthorityMetadata)), + scheduleDeleteCertificateAuthority: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + scheduleDeleteCertificateAuthorityResponse.decode.bind(scheduleDeleteCertificateAuthorityResponse), + scheduleDeleteCertificateAuthorityMetadata.decode.bind(scheduleDeleteCertificateAuthorityMetadata)), + updateCertificateAuthority: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateCertificateAuthorityResponse.decode.bind(updateCertificateAuthorityResponse), + updateCertificateAuthorityMetadata.decode.bind(updateCertificateAuthorityMetadata)), + updateCertificateRevocationList: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateCertificateRevocationListResponse.decode.bind(updateCertificateRevocationListResponse), + updateCertificateRevocationListMetadata.decode.bind(updateCertificateRevocationListMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.security.privateca.v1beta1.CertificateAuthorityService', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.certificateAuthorityServiceStub) { + return this.certificateAuthorityServiceStub; + } + + // Put together the "service stub" for + // google.cloud.security.privateca.v1beta1.CertificateAuthorityService. + this.certificateAuthorityServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.security.privateca.v1beta1.CertificateAuthorityService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.security.privateca.v1beta1.CertificateAuthorityService, + 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 certificateAuthorityServiceStubMethods = + ['createCertificate', 'getCertificate', 'listCertificates', 'revokeCertificate', 'updateCertificate', 'activateCertificateAuthority', 'createCertificateAuthority', 'disableCertificateAuthority', 'enableCertificateAuthority', 'fetchCertificateAuthorityCsr', 'getCertificateAuthority', 'listCertificateAuthorities', 'restoreCertificateAuthority', 'scheduleDeleteCertificateAuthority', 'updateCertificateAuthority', 'getCertificateRevocationList', 'listCertificateRevocationLists', 'updateCertificateRevocationList', 'getReusableConfig', 'listReusableConfigs']; + for (const methodName of certificateAuthorityServiceStubMethods) { + const callPromise = this.certificateAuthorityServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.certificateAuthorityServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'privateca.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 'privateca.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- +/** + * Create a new {@link google.cloud.security.privateca.v1beta1.Certificate|Certificate} in a given Project, Location from a particular + * {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthority}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the location and {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthority} + * associated with the {@link google.cloud.security.privateca.v1beta1.Certificate|Certificate}, in the format + * `projects/* /locations/* /certificateAuthorities/*`. + * @param {string} [request.certificateId] + * Optional. It must be unique within a location and match the regular + * expression `[a-zA-Z0-9_-]{1,63}`. This field is required when using a + * {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthority} in the Enterprise {@link google.cloud.security.privateca.v1beta1.CertificateAuthority.Tier|CertificateAuthority.Tier}, + * but is optional and its value is ignored otherwise. + * @param {google.cloud.security.privateca.v1beta1.Certificate} request.certificate + * Required. A {@link google.cloud.security.privateca.v1beta1.Certificate|Certificate} with initial field values. + * @param {string} [request.requestId] + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [Certificate]{@link google.cloud.security.privateca.v1beta1.Certificate}. + * 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/v1beta1/certificate_authority_service.create_certificate.js + * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_CreateCertificate_async + */ + createCertificate( + request?: protos.google.cloud.security.privateca.v1beta1.ICreateCertificateRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.security.privateca.v1beta1.ICertificate, + protos.google.cloud.security.privateca.v1beta1.ICreateCertificateRequest|undefined, {}|undefined + ]>; + createCertificate( + request: protos.google.cloud.security.privateca.v1beta1.ICreateCertificateRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.security.privateca.v1beta1.ICertificate, + protos.google.cloud.security.privateca.v1beta1.ICreateCertificateRequest|null|undefined, + {}|null|undefined>): void; + createCertificate( + request: protos.google.cloud.security.privateca.v1beta1.ICreateCertificateRequest, + callback: Callback< + protos.google.cloud.security.privateca.v1beta1.ICertificate, + protos.google.cloud.security.privateca.v1beta1.ICreateCertificateRequest|null|undefined, + {}|null|undefined>): void; + createCertificate( + request?: protos.google.cloud.security.privateca.v1beta1.ICreateCertificateRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.security.privateca.v1beta1.ICertificate, + protos.google.cloud.security.privateca.v1beta1.ICreateCertificateRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.security.privateca.v1beta1.ICertificate, + protos.google.cloud.security.privateca.v1beta1.ICreateCertificateRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.security.privateca.v1beta1.ICertificate, + protos.google.cloud.security.privateca.v1beta1.ICreateCertificateRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createCertificate(request, options, callback); + } +/** + * Returns a {@link google.cloud.security.privateca.v1beta1.Certificate|Certificate}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The {@link google.cloud.security.privateca.v1beta1.Certificate.name|name} of the {@link google.cloud.security.privateca.v1beta1.Certificate|Certificate} 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 [Certificate]{@link google.cloud.security.privateca.v1beta1.Certificate}. + * 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/v1beta1/certificate_authority_service.get_certificate.js + * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_GetCertificate_async + */ + getCertificate( + request?: protos.google.cloud.security.privateca.v1beta1.IGetCertificateRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.security.privateca.v1beta1.ICertificate, + protos.google.cloud.security.privateca.v1beta1.IGetCertificateRequest|undefined, {}|undefined + ]>; + getCertificate( + request: protos.google.cloud.security.privateca.v1beta1.IGetCertificateRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.security.privateca.v1beta1.ICertificate, + protos.google.cloud.security.privateca.v1beta1.IGetCertificateRequest|null|undefined, + {}|null|undefined>): void; + getCertificate( + request: protos.google.cloud.security.privateca.v1beta1.IGetCertificateRequest, + callback: Callback< + protos.google.cloud.security.privateca.v1beta1.ICertificate, + protos.google.cloud.security.privateca.v1beta1.IGetCertificateRequest|null|undefined, + {}|null|undefined>): void; + getCertificate( + request?: protos.google.cloud.security.privateca.v1beta1.IGetCertificateRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.security.privateca.v1beta1.ICertificate, + protos.google.cloud.security.privateca.v1beta1.IGetCertificateRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.security.privateca.v1beta1.ICertificate, + protos.google.cloud.security.privateca.v1beta1.IGetCertificateRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.security.privateca.v1beta1.ICertificate, + protos.google.cloud.security.privateca.v1beta1.IGetCertificateRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getCertificate(request, options, callback); + } +/** + * Revoke a {@link google.cloud.security.privateca.v1beta1.Certificate|Certificate}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name for this {@link google.cloud.security.privateca.v1beta1.Certificate|Certificate} in the + * format `projects/* /locations/* /certificateAuthorities/* /certificates/*`. + * @param {google.cloud.security.privateca.v1beta1.RevocationReason} request.reason + * Required. The {@link google.cloud.security.privateca.v1beta1.RevocationReason|RevocationReason} for revoking this certificate. + * @param {string} [request.requestId] + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [Certificate]{@link google.cloud.security.privateca.v1beta1.Certificate}. + * 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/v1beta1/certificate_authority_service.revoke_certificate.js + * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_RevokeCertificate_async + */ + revokeCertificate( + request?: protos.google.cloud.security.privateca.v1beta1.IRevokeCertificateRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.security.privateca.v1beta1.ICertificate, + protos.google.cloud.security.privateca.v1beta1.IRevokeCertificateRequest|undefined, {}|undefined + ]>; + revokeCertificate( + request: protos.google.cloud.security.privateca.v1beta1.IRevokeCertificateRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.security.privateca.v1beta1.ICertificate, + protos.google.cloud.security.privateca.v1beta1.IRevokeCertificateRequest|null|undefined, + {}|null|undefined>): void; + revokeCertificate( + request: protos.google.cloud.security.privateca.v1beta1.IRevokeCertificateRequest, + callback: Callback< + protos.google.cloud.security.privateca.v1beta1.ICertificate, + protos.google.cloud.security.privateca.v1beta1.IRevokeCertificateRequest|null|undefined, + {}|null|undefined>): void; + revokeCertificate( + request?: protos.google.cloud.security.privateca.v1beta1.IRevokeCertificateRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.security.privateca.v1beta1.ICertificate, + protos.google.cloud.security.privateca.v1beta1.IRevokeCertificateRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.security.privateca.v1beta1.ICertificate, + protos.google.cloud.security.privateca.v1beta1.IRevokeCertificateRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.security.privateca.v1beta1.ICertificate, + protos.google.cloud.security.privateca.v1beta1.IRevokeCertificateRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.revokeCertificate(request, options, callback); + } +/** + * Update a {@link google.cloud.security.privateca.v1beta1.Certificate|Certificate}. Currently, the only field you can update is the + * {@link google.cloud.security.privateca.v1beta1.Certificate.labels|labels} field. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.security.privateca.v1beta1.Certificate} request.certificate + * Required. {@link google.cloud.security.privateca.v1beta1.Certificate|Certificate} with updated values. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. A list of fields to be updated in this request. + * @param {string} [request.requestId] + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [Certificate]{@link google.cloud.security.privateca.v1beta1.Certificate}. + * 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/v1beta1/certificate_authority_service.update_certificate.js + * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificate_async + */ + updateCertificate( + request?: protos.google.cloud.security.privateca.v1beta1.IUpdateCertificateRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.security.privateca.v1beta1.ICertificate, + protos.google.cloud.security.privateca.v1beta1.IUpdateCertificateRequest|undefined, {}|undefined + ]>; + updateCertificate( + request: protos.google.cloud.security.privateca.v1beta1.IUpdateCertificateRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.security.privateca.v1beta1.ICertificate, + protos.google.cloud.security.privateca.v1beta1.IUpdateCertificateRequest|null|undefined, + {}|null|undefined>): void; + updateCertificate( + request: protos.google.cloud.security.privateca.v1beta1.IUpdateCertificateRequest, + callback: Callback< + protos.google.cloud.security.privateca.v1beta1.ICertificate, + protos.google.cloud.security.privateca.v1beta1.IUpdateCertificateRequest|null|undefined, + {}|null|undefined>): void; + updateCertificate( + request?: protos.google.cloud.security.privateca.v1beta1.IUpdateCertificateRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.security.privateca.v1beta1.ICertificate, + protos.google.cloud.security.privateca.v1beta1.IUpdateCertificateRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.security.privateca.v1beta1.ICertificate, + protos.google.cloud.security.privateca.v1beta1.IUpdateCertificateRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.security.privateca.v1beta1.ICertificate, + protos.google.cloud.security.privateca.v1beta1.IUpdateCertificateRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'certificate.name': request.certificate!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateCertificate(request, options, callback); + } +/** + * Fetch a certificate signing request (CSR) from a {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthority} + * that is in state + * {@link google.cloud.security.privateca.v1beta1.CertificateAuthority.State.PENDING_ACTIVATION|PENDING_ACTIVATION} and is + * of type {@link google.cloud.security.privateca.v1beta1.CertificateAuthority.Type.SUBORDINATE|SUBORDINATE}. The CSR must + * then be signed by the desired parent Certificate Authority, which could be + * another {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthority} resource, or could be an on-prem + * certificate authority. See also {@link google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ActivateCertificateAuthority|ActivateCertificateAuthority}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name for this {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthority} in the + * format `projects/* /locations/* /certificateAuthorities/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [FetchCertificateAuthorityCsrResponse]{@link google.cloud.security.privateca.v1beta1.FetchCertificateAuthorityCsrResponse}. + * 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/v1beta1/certificate_authority_service.fetch_certificate_authority_csr.js + * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_FetchCertificateAuthorityCsr_async + */ + fetchCertificateAuthorityCsr( + request?: protos.google.cloud.security.privateca.v1beta1.IFetchCertificateAuthorityCsrRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.security.privateca.v1beta1.IFetchCertificateAuthorityCsrResponse, + protos.google.cloud.security.privateca.v1beta1.IFetchCertificateAuthorityCsrRequest|undefined, {}|undefined + ]>; + fetchCertificateAuthorityCsr( + request: protos.google.cloud.security.privateca.v1beta1.IFetchCertificateAuthorityCsrRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.security.privateca.v1beta1.IFetchCertificateAuthorityCsrResponse, + protos.google.cloud.security.privateca.v1beta1.IFetchCertificateAuthorityCsrRequest|null|undefined, + {}|null|undefined>): void; + fetchCertificateAuthorityCsr( + request: protos.google.cloud.security.privateca.v1beta1.IFetchCertificateAuthorityCsrRequest, + callback: Callback< + protos.google.cloud.security.privateca.v1beta1.IFetchCertificateAuthorityCsrResponse, + protos.google.cloud.security.privateca.v1beta1.IFetchCertificateAuthorityCsrRequest|null|undefined, + {}|null|undefined>): void; + fetchCertificateAuthorityCsr( + request?: protos.google.cloud.security.privateca.v1beta1.IFetchCertificateAuthorityCsrRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.security.privateca.v1beta1.IFetchCertificateAuthorityCsrResponse, + protos.google.cloud.security.privateca.v1beta1.IFetchCertificateAuthorityCsrRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.security.privateca.v1beta1.IFetchCertificateAuthorityCsrResponse, + protos.google.cloud.security.privateca.v1beta1.IFetchCertificateAuthorityCsrRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.security.privateca.v1beta1.IFetchCertificateAuthorityCsrResponse, + protos.google.cloud.security.privateca.v1beta1.IFetchCertificateAuthorityCsrRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.fetchCertificateAuthorityCsr(request, options, callback); + } +/** + * Returns a {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthority}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The {@link google.cloud.security.privateca.v1beta1.CertificateAuthority.name|name} of the {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthority} 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 [CertificateAuthority]{@link google.cloud.security.privateca.v1beta1.CertificateAuthority}. + * 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/v1beta1/certificate_authority_service.get_certificate_authority.js + * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_GetCertificateAuthority_async + */ + getCertificateAuthority( + request?: protos.google.cloud.security.privateca.v1beta1.IGetCertificateAuthorityRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.security.privateca.v1beta1.ICertificateAuthority, + protos.google.cloud.security.privateca.v1beta1.IGetCertificateAuthorityRequest|undefined, {}|undefined + ]>; + getCertificateAuthority( + request: protos.google.cloud.security.privateca.v1beta1.IGetCertificateAuthorityRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.security.privateca.v1beta1.ICertificateAuthority, + protos.google.cloud.security.privateca.v1beta1.IGetCertificateAuthorityRequest|null|undefined, + {}|null|undefined>): void; + getCertificateAuthority( + request: protos.google.cloud.security.privateca.v1beta1.IGetCertificateAuthorityRequest, + callback: Callback< + protos.google.cloud.security.privateca.v1beta1.ICertificateAuthority, + protos.google.cloud.security.privateca.v1beta1.IGetCertificateAuthorityRequest|null|undefined, + {}|null|undefined>): void; + getCertificateAuthority( + request?: protos.google.cloud.security.privateca.v1beta1.IGetCertificateAuthorityRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.security.privateca.v1beta1.ICertificateAuthority, + protos.google.cloud.security.privateca.v1beta1.IGetCertificateAuthorityRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.security.privateca.v1beta1.ICertificateAuthority, + protos.google.cloud.security.privateca.v1beta1.IGetCertificateAuthorityRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.security.privateca.v1beta1.ICertificateAuthority, + protos.google.cloud.security.privateca.v1beta1.IGetCertificateAuthorityRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getCertificateAuthority(request, options, callback); + } +/** + * Returns a {@link google.cloud.security.privateca.v1beta1.CertificateRevocationList|CertificateRevocationList}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The {@link google.cloud.security.privateca.v1beta1.CertificateRevocationList.name|name} of the + * {@link google.cloud.security.privateca.v1beta1.CertificateRevocationList|CertificateRevocationList} 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 [CertificateRevocationList]{@link google.cloud.security.privateca.v1beta1.CertificateRevocationList}. + * 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/v1beta1/certificate_authority_service.get_certificate_revocation_list.js + * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_GetCertificateRevocationList_async + */ + getCertificateRevocationList( + request?: protos.google.cloud.security.privateca.v1beta1.IGetCertificateRevocationListRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.security.privateca.v1beta1.ICertificateRevocationList, + protos.google.cloud.security.privateca.v1beta1.IGetCertificateRevocationListRequest|undefined, {}|undefined + ]>; + getCertificateRevocationList( + request: protos.google.cloud.security.privateca.v1beta1.IGetCertificateRevocationListRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.security.privateca.v1beta1.ICertificateRevocationList, + protos.google.cloud.security.privateca.v1beta1.IGetCertificateRevocationListRequest|null|undefined, + {}|null|undefined>): void; + getCertificateRevocationList( + request: protos.google.cloud.security.privateca.v1beta1.IGetCertificateRevocationListRequest, + callback: Callback< + protos.google.cloud.security.privateca.v1beta1.ICertificateRevocationList, + protos.google.cloud.security.privateca.v1beta1.IGetCertificateRevocationListRequest|null|undefined, + {}|null|undefined>): void; + getCertificateRevocationList( + request?: protos.google.cloud.security.privateca.v1beta1.IGetCertificateRevocationListRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.security.privateca.v1beta1.ICertificateRevocationList, + protos.google.cloud.security.privateca.v1beta1.IGetCertificateRevocationListRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.security.privateca.v1beta1.ICertificateRevocationList, + protos.google.cloud.security.privateca.v1beta1.IGetCertificateRevocationListRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.security.privateca.v1beta1.ICertificateRevocationList, + protos.google.cloud.security.privateca.v1beta1.IGetCertificateRevocationListRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getCertificateRevocationList(request, options, callback); + } +/** + * Returns a {@link google.cloud.security.privateca.v1beta1.ReusableConfig|ReusableConfig}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The {@link ReusableConfigs.name|name} of the {@link |ReusableConfigs} 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 [ReusableConfig]{@link google.cloud.security.privateca.v1beta1.ReusableConfig}. + * 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/v1beta1/certificate_authority_service.get_reusable_config.js + * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_GetReusableConfig_async + */ + getReusableConfig( + request?: protos.google.cloud.security.privateca.v1beta1.IGetReusableConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.security.privateca.v1beta1.IReusableConfig, + protos.google.cloud.security.privateca.v1beta1.IGetReusableConfigRequest|undefined, {}|undefined + ]>; + getReusableConfig( + request: protos.google.cloud.security.privateca.v1beta1.IGetReusableConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.security.privateca.v1beta1.IReusableConfig, + protos.google.cloud.security.privateca.v1beta1.IGetReusableConfigRequest|null|undefined, + {}|null|undefined>): void; + getReusableConfig( + request: protos.google.cloud.security.privateca.v1beta1.IGetReusableConfigRequest, + callback: Callback< + protos.google.cloud.security.privateca.v1beta1.IReusableConfig, + protos.google.cloud.security.privateca.v1beta1.IGetReusableConfigRequest|null|undefined, + {}|null|undefined>): void; + getReusableConfig( + request?: protos.google.cloud.security.privateca.v1beta1.IGetReusableConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.security.privateca.v1beta1.IReusableConfig, + protos.google.cloud.security.privateca.v1beta1.IGetReusableConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.security.privateca.v1beta1.IReusableConfig, + protos.google.cloud.security.privateca.v1beta1.IGetReusableConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.security.privateca.v1beta1.IReusableConfig, + protos.google.cloud.security.privateca.v1beta1.IGetReusableConfigRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getReusableConfig(request, options, callback); + } + +/** + * Activate a {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthority} that is in state + * {@link google.cloud.security.privateca.v1beta1.CertificateAuthority.State.PENDING_ACTIVATION|PENDING_ACTIVATION} and is + * of type {@link google.cloud.security.privateca.v1beta1.CertificateAuthority.Type.SUBORDINATE|SUBORDINATE}. After the + * parent Certificate Authority signs a certificate signing request from + * {@link google.cloud.security.privateca.v1beta1.CertificateAuthorityService.FetchCertificateAuthorityCsr|FetchCertificateAuthorityCsr}, this method can complete the activation + * process. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name for this {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthority} in the + * format `projects/* /locations/* /certificateAuthorities/*`. + * @param {string} request.pemCaCertificate + * Required. The signed CA certificate issued from + * {@link google.cloud.security.privateca.v1beta1.FetchCertificateAuthorityCsrResponse.pem_csr|FetchCertificateAuthorityCsrResponse.pem_csr}. + * @param {google.cloud.security.privateca.v1beta1.SubordinateConfig} request.subordinateConfig + * Required. Must include information about the issuer of 'pem_ca_certificate', and any + * further issuers until the self-signed CA. + * @param {string} [request.requestId] + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1beta1/certificate_authority_service.activate_certificate_authority.js + * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_ActivateCertificateAuthority_async + */ + activateCertificateAuthority( + request?: protos.google.cloud.security.privateca.v1beta1.IActivateCertificateAuthorityRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + activateCertificateAuthority( + request: protos.google.cloud.security.privateca.v1beta1.IActivateCertificateAuthorityRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + activateCertificateAuthority( + request: protos.google.cloud.security.privateca.v1beta1.IActivateCertificateAuthorityRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + activateCertificateAuthority( + request?: protos.google.cloud.security.privateca.v1beta1.IActivateCertificateAuthorityRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.activateCertificateAuthority(request, options, callback); + } +/** + * Check the status of the long running operation returned by `activateCertificateAuthority()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1beta1/certificate_authority_service.activate_certificate_authority.js + * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_ActivateCertificateAuthority_async + */ + async checkActivateCertificateAuthorityProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.activateCertificateAuthority, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Create a new {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthority} 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.security.privateca.v1beta1.CertificateAuthority|CertificateAuthorities}, in the format + * `projects/* /locations/*`. + * @param {string} request.certificateAuthorityId + * Required. It must be unique within a location and match the regular + * expression `[a-zA-Z0-9_-]{1,63}` + * @param {google.cloud.security.privateca.v1beta1.CertificateAuthority} request.certificateAuthority + * Required. A {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthority} with initial field values. + * @param {string} [request.requestId] + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1beta1/certificate_authority_service.create_certificate_authority.js + * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_CreateCertificateAuthority_async + */ + createCertificateAuthority( + request?: protos.google.cloud.security.privateca.v1beta1.ICreateCertificateAuthorityRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createCertificateAuthority( + request: protos.google.cloud.security.privateca.v1beta1.ICreateCertificateAuthorityRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createCertificateAuthority( + request: protos.google.cloud.security.privateca.v1beta1.ICreateCertificateAuthorityRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createCertificateAuthority( + request?: protos.google.cloud.security.privateca.v1beta1.ICreateCertificateAuthorityRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createCertificateAuthority(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createCertificateAuthority()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1beta1/certificate_authority_service.create_certificate_authority.js + * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_CreateCertificateAuthority_async + */ + async checkCreateCertificateAuthorityProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createCertificateAuthority, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Disable a {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthority}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name for this {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthority} in the + * format `projects/* /locations/* /certificateAuthorities/*`. + * @param {string} [request.requestId] + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1beta1/certificate_authority_service.disable_certificate_authority.js + * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_DisableCertificateAuthority_async + */ + disableCertificateAuthority( + request?: protos.google.cloud.security.privateca.v1beta1.IDisableCertificateAuthorityRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + disableCertificateAuthority( + request: protos.google.cloud.security.privateca.v1beta1.IDisableCertificateAuthorityRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + disableCertificateAuthority( + request: protos.google.cloud.security.privateca.v1beta1.IDisableCertificateAuthorityRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + disableCertificateAuthority( + request?: protos.google.cloud.security.privateca.v1beta1.IDisableCertificateAuthorityRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.disableCertificateAuthority(request, options, callback); + } +/** + * Check the status of the long running operation returned by `disableCertificateAuthority()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1beta1/certificate_authority_service.disable_certificate_authority.js + * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_DisableCertificateAuthority_async + */ + async checkDisableCertificateAuthorityProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.disableCertificateAuthority, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Enable a {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthority}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name for this {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthority} in the + * format `projects/* /locations/* /certificateAuthorities/*`. + * @param {string} [request.requestId] + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1beta1/certificate_authority_service.enable_certificate_authority.js + * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_EnableCertificateAuthority_async + */ + enableCertificateAuthority( + request?: protos.google.cloud.security.privateca.v1beta1.IEnableCertificateAuthorityRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + enableCertificateAuthority( + request: protos.google.cloud.security.privateca.v1beta1.IEnableCertificateAuthorityRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + enableCertificateAuthority( + request: protos.google.cloud.security.privateca.v1beta1.IEnableCertificateAuthorityRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + enableCertificateAuthority( + request?: protos.google.cloud.security.privateca.v1beta1.IEnableCertificateAuthorityRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.enableCertificateAuthority(request, options, callback); + } +/** + * Check the status of the long running operation returned by `enableCertificateAuthority()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1beta1/certificate_authority_service.enable_certificate_authority.js + * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_EnableCertificateAuthority_async + */ + async checkEnableCertificateAuthorityProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.enableCertificateAuthority, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Restore a {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthority} that is scheduled for deletion. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name for this {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthority} in the + * format `projects/* /locations/* /certificateAuthorities/*`. + * @param {string} [request.requestId] + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1beta1/certificate_authority_service.restore_certificate_authority.js + * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_RestoreCertificateAuthority_async + */ + restoreCertificateAuthority( + request?: protos.google.cloud.security.privateca.v1beta1.IRestoreCertificateAuthorityRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + restoreCertificateAuthority( + request: protos.google.cloud.security.privateca.v1beta1.IRestoreCertificateAuthorityRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + restoreCertificateAuthority( + request: protos.google.cloud.security.privateca.v1beta1.IRestoreCertificateAuthorityRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + restoreCertificateAuthority( + request?: protos.google.cloud.security.privateca.v1beta1.IRestoreCertificateAuthorityRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.restoreCertificateAuthority(request, options, callback); + } +/** + * Check the status of the long running operation returned by `restoreCertificateAuthority()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1beta1/certificate_authority_service.restore_certificate_authority.js + * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_RestoreCertificateAuthority_async + */ + async checkRestoreCertificateAuthorityProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.restoreCertificateAuthority, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Schedule a {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthority} for deletion. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name for this {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthority} in the + * format `projects/* /locations/* /certificateAuthorities/*`. + * @param {string} [request.requestId] + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1beta1/certificate_authority_service.schedule_delete_certificate_authority.js + * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_ScheduleDeleteCertificateAuthority_async + */ + scheduleDeleteCertificateAuthority( + request?: protos.google.cloud.security.privateca.v1beta1.IScheduleDeleteCertificateAuthorityRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + scheduleDeleteCertificateAuthority( + request: protos.google.cloud.security.privateca.v1beta1.IScheduleDeleteCertificateAuthorityRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + scheduleDeleteCertificateAuthority( + request: protos.google.cloud.security.privateca.v1beta1.IScheduleDeleteCertificateAuthorityRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + scheduleDeleteCertificateAuthority( + request?: protos.google.cloud.security.privateca.v1beta1.IScheduleDeleteCertificateAuthorityRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.scheduleDeleteCertificateAuthority(request, options, callback); + } +/** + * Check the status of the long running operation returned by `scheduleDeleteCertificateAuthority()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1beta1/certificate_authority_service.schedule_delete_certificate_authority.js + * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_ScheduleDeleteCertificateAuthority_async + */ + async checkScheduleDeleteCertificateAuthorityProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.scheduleDeleteCertificateAuthority, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Update a {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthority}. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.security.privateca.v1beta1.CertificateAuthority} request.certificateAuthority + * Required. {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthority} with updated values. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. A list of fields to be updated in this request. + * @param {string} [request.requestId] + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1beta1/certificate_authority_service.update_certificate_authority.js + * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificateAuthority_async + */ + updateCertificateAuthority( + request?: protos.google.cloud.security.privateca.v1beta1.IUpdateCertificateAuthorityRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateCertificateAuthority( + request: protos.google.cloud.security.privateca.v1beta1.IUpdateCertificateAuthorityRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateCertificateAuthority( + request: protos.google.cloud.security.privateca.v1beta1.IUpdateCertificateAuthorityRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateCertificateAuthority( + request?: protos.google.cloud.security.privateca.v1beta1.IUpdateCertificateAuthorityRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'certificate_authority.name': request.certificateAuthority!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateCertificateAuthority(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateCertificateAuthority()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1beta1/certificate_authority_service.update_certificate_authority.js + * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificateAuthority_async + */ + async checkUpdateCertificateAuthorityProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.updateCertificateAuthority, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Update a {@link google.cloud.security.privateca.v1beta1.CertificateRevocationList|CertificateRevocationList}. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.security.privateca.v1beta1.CertificateRevocationList} request.certificateRevocationList + * Required. {@link google.cloud.security.privateca.v1beta1.CertificateRevocationList|CertificateRevocationList} with updated values. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. A list of fields to be updated in this request. + * @param {string} [request.requestId] + * Optional. An ID to identify requests. Specify a unique request ID so that if you must + * retry your request, the server will know to ignore the request if it has + * already been completed. The server will guarantee that for at least 60 + * minutes since the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1beta1/certificate_authority_service.update_certificate_revocation_list.js + * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificateRevocationList_async + */ + updateCertificateRevocationList( + request?: protos.google.cloud.security.privateca.v1beta1.IUpdateCertificateRevocationListRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateCertificateRevocationList( + request: protos.google.cloud.security.privateca.v1beta1.IUpdateCertificateRevocationListRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateCertificateRevocationList( + request: protos.google.cloud.security.privateca.v1beta1.IUpdateCertificateRevocationListRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateCertificateRevocationList( + request?: protos.google.cloud.security.privateca.v1beta1.IUpdateCertificateRevocationListRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'certificate_revocation_list.name': request.certificateRevocationList!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateCertificateRevocationList(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateCertificateRevocationList()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1beta1/certificate_authority_service.update_certificate_revocation_list.js + * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificateRevocationList_async + */ + async checkUpdateCertificateRevocationListProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.updateCertificateRevocationList, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists {@link google.cloud.security.privateca.v1beta1.Certificate|Certificates}. + * + * @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.security.privateca.v1beta1.Certificate|Certificates}, in the format + * `projects/* /locations/* /certificateauthorities/*`. + * @param {number} [request.pageSize] + * Optional. Limit on the number of + * {@link google.cloud.security.privateca.v1beta1.Certificate|Certificates} to include in the + * response. Further {@link google.cloud.security.privateca.v1beta1.Certificate|Certificates} can subsequently be obtained + * by including the + * {@link google.cloud.security.privateca.v1beta1.ListCertificatesResponse.next_page_token|ListCertificatesResponse.next_page_token} in a subsequent + * request. If unspecified, the server will pick an appropriate default. + * @param {string} [request.pageToken] + * Optional. Pagination token, returned earlier via + * {@link google.cloud.security.privateca.v1beta1.ListCertificatesResponse.next_page_token|ListCertificatesResponse.next_page_token}. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. For details + * on supported filters and syntax, see [Certificates Filtering + * documentation](https://cloud.google.com/certificate-authority-service/docs/sorting-filtering-certificates#filtering_support). + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. For details on supported fields + * and syntax, see [Certificates Sorting + * documentation](https://cloud.google.com/certificate-authority-service/docs/sorting-filtering-certificates#sorting_support). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [Certificate]{@link google.cloud.security.privateca.v1beta1.Certificate}. + * 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 `listCertificatesAsync()` + * 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. + */ + listCertificates( + request?: protos.google.cloud.security.privateca.v1beta1.IListCertificatesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.security.privateca.v1beta1.ICertificate[], + protos.google.cloud.security.privateca.v1beta1.IListCertificatesRequest|null, + protos.google.cloud.security.privateca.v1beta1.IListCertificatesResponse + ]>; + listCertificates( + request: protos.google.cloud.security.privateca.v1beta1.IListCertificatesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.security.privateca.v1beta1.IListCertificatesRequest, + protos.google.cloud.security.privateca.v1beta1.IListCertificatesResponse|null|undefined, + protos.google.cloud.security.privateca.v1beta1.ICertificate>): void; + listCertificates( + request: protos.google.cloud.security.privateca.v1beta1.IListCertificatesRequest, + callback: PaginationCallback< + protos.google.cloud.security.privateca.v1beta1.IListCertificatesRequest, + protos.google.cloud.security.privateca.v1beta1.IListCertificatesResponse|null|undefined, + protos.google.cloud.security.privateca.v1beta1.ICertificate>): void; + listCertificates( + request?: protos.google.cloud.security.privateca.v1beta1.IListCertificatesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.security.privateca.v1beta1.IListCertificatesRequest, + protos.google.cloud.security.privateca.v1beta1.IListCertificatesResponse|null|undefined, + protos.google.cloud.security.privateca.v1beta1.ICertificate>, + callback?: PaginationCallback< + protos.google.cloud.security.privateca.v1beta1.IListCertificatesRequest, + protos.google.cloud.security.privateca.v1beta1.IListCertificatesResponse|null|undefined, + protos.google.cloud.security.privateca.v1beta1.ICertificate>): + Promise<[ + protos.google.cloud.security.privateca.v1beta1.ICertificate[], + protos.google.cloud.security.privateca.v1beta1.IListCertificatesRequest|null, + protos.google.cloud.security.privateca.v1beta1.IListCertificatesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listCertificates(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.security.privateca.v1beta1.Certificate|Certificates}, in the format + * `projects/* /locations/* /certificateauthorities/*`. + * @param {number} [request.pageSize] + * Optional. Limit on the number of + * {@link google.cloud.security.privateca.v1beta1.Certificate|Certificates} to include in the + * response. Further {@link google.cloud.security.privateca.v1beta1.Certificate|Certificates} can subsequently be obtained + * by including the + * {@link google.cloud.security.privateca.v1beta1.ListCertificatesResponse.next_page_token|ListCertificatesResponse.next_page_token} in a subsequent + * request. If unspecified, the server will pick an appropriate default. + * @param {string} [request.pageToken] + * Optional. Pagination token, returned earlier via + * {@link google.cloud.security.privateca.v1beta1.ListCertificatesResponse.next_page_token|ListCertificatesResponse.next_page_token}. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. For details + * on supported filters and syntax, see [Certificates Filtering + * documentation](https://cloud.google.com/certificate-authority-service/docs/sorting-filtering-certificates#filtering_support). + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. For details on supported fields + * and syntax, see [Certificates Sorting + * documentation](https://cloud.google.com/certificate-authority-service/docs/sorting-filtering-certificates#sorting_support). + * @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 [Certificate]{@link google.cloud.security.privateca.v1beta1.Certificate} 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 `listCertificatesAsync()` + * 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. + */ + listCertificatesStream( + request?: protos.google.cloud.security.privateca.v1beta1.IListCertificatesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listCertificates']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listCertificates.createStream( + this.innerApiCalls.listCertificates as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listCertificates`, 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.security.privateca.v1beta1.Certificate|Certificates}, in the format + * `projects/* /locations/* /certificateauthorities/*`. + * @param {number} [request.pageSize] + * Optional. Limit on the number of + * {@link google.cloud.security.privateca.v1beta1.Certificate|Certificates} to include in the + * response. Further {@link google.cloud.security.privateca.v1beta1.Certificate|Certificates} can subsequently be obtained + * by including the + * {@link google.cloud.security.privateca.v1beta1.ListCertificatesResponse.next_page_token|ListCertificatesResponse.next_page_token} in a subsequent + * request. If unspecified, the server will pick an appropriate default. + * @param {string} [request.pageToken] + * Optional. Pagination token, returned earlier via + * {@link google.cloud.security.privateca.v1beta1.ListCertificatesResponse.next_page_token|ListCertificatesResponse.next_page_token}. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. For details + * on supported filters and syntax, see [Certificates Filtering + * documentation](https://cloud.google.com/certificate-authority-service/docs/sorting-filtering-certificates#filtering_support). + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. For details on supported fields + * and syntax, see [Certificates Sorting + * documentation](https://cloud.google.com/certificate-authority-service/docs/sorting-filtering-certificates#sorting_support). + * @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 + * [Certificate]{@link google.cloud.security.privateca.v1beta1.Certificate}. 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/v1beta1/certificate_authority_service.list_certificates.js + * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_ListCertificates_async + */ + listCertificatesAsync( + request?: protos.google.cloud.security.privateca.v1beta1.IListCertificatesRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listCertificates']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listCertificates.asyncIterate( + this.innerApiCalls['listCertificates'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + /** + * Lists {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthorities}. + * + * @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.security.privateca.v1beta1.CertificateAuthority|CertificateAuthorities}, in the format + * `projects/* /locations/*`. + * @param {number} [request.pageSize] + * Optional. Limit on the number of {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthorities} to + * include in the response. + * Further {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthorities} can subsequently be + * obtained by including the + * {@link google.cloud.security.privateca.v1beta1.ListCertificateAuthoritiesResponse.next_page_token|ListCertificateAuthoritiesResponse.next_page_token} in a subsequent + * request. If unspecified, the server will pick an appropriate default. + * @param {string} [request.pageToken] + * Optional. Pagination token, returned earlier via + * {@link google.cloud.security.privateca.v1beta1.ListCertificateAuthoritiesResponse.next_page_token|ListCertificateAuthoritiesResponse.next_page_token}. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [CertificateAuthority]{@link google.cloud.security.privateca.v1beta1.CertificateAuthority}. + * 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 `listCertificateAuthoritiesAsync()` + * 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. + */ + listCertificateAuthorities( + request?: protos.google.cloud.security.privateca.v1beta1.IListCertificateAuthoritiesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.security.privateca.v1beta1.ICertificateAuthority[], + protos.google.cloud.security.privateca.v1beta1.IListCertificateAuthoritiesRequest|null, + protos.google.cloud.security.privateca.v1beta1.IListCertificateAuthoritiesResponse + ]>; + listCertificateAuthorities( + request: protos.google.cloud.security.privateca.v1beta1.IListCertificateAuthoritiesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.security.privateca.v1beta1.IListCertificateAuthoritiesRequest, + protos.google.cloud.security.privateca.v1beta1.IListCertificateAuthoritiesResponse|null|undefined, + protos.google.cloud.security.privateca.v1beta1.ICertificateAuthority>): void; + listCertificateAuthorities( + request: protos.google.cloud.security.privateca.v1beta1.IListCertificateAuthoritiesRequest, + callback: PaginationCallback< + protos.google.cloud.security.privateca.v1beta1.IListCertificateAuthoritiesRequest, + protos.google.cloud.security.privateca.v1beta1.IListCertificateAuthoritiesResponse|null|undefined, + protos.google.cloud.security.privateca.v1beta1.ICertificateAuthority>): void; + listCertificateAuthorities( + request?: protos.google.cloud.security.privateca.v1beta1.IListCertificateAuthoritiesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.security.privateca.v1beta1.IListCertificateAuthoritiesRequest, + protos.google.cloud.security.privateca.v1beta1.IListCertificateAuthoritiesResponse|null|undefined, + protos.google.cloud.security.privateca.v1beta1.ICertificateAuthority>, + callback?: PaginationCallback< + protos.google.cloud.security.privateca.v1beta1.IListCertificateAuthoritiesRequest, + protos.google.cloud.security.privateca.v1beta1.IListCertificateAuthoritiesResponse|null|undefined, + protos.google.cloud.security.privateca.v1beta1.ICertificateAuthority>): + Promise<[ + protos.google.cloud.security.privateca.v1beta1.ICertificateAuthority[], + protos.google.cloud.security.privateca.v1beta1.IListCertificateAuthoritiesRequest|null, + protos.google.cloud.security.privateca.v1beta1.IListCertificateAuthoritiesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listCertificateAuthorities(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.security.privateca.v1beta1.CertificateAuthority|CertificateAuthorities}, in the format + * `projects/* /locations/*`. + * @param {number} [request.pageSize] + * Optional. Limit on the number of {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthorities} to + * include in the response. + * Further {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthorities} can subsequently be + * obtained by including the + * {@link google.cloud.security.privateca.v1beta1.ListCertificateAuthoritiesResponse.next_page_token|ListCertificateAuthoritiesResponse.next_page_token} in a subsequent + * request. If unspecified, the server will pick an appropriate default. + * @param {string} [request.pageToken] + * Optional. Pagination token, returned earlier via + * {@link google.cloud.security.privateca.v1beta1.ListCertificateAuthoritiesResponse.next_page_token|ListCertificateAuthoritiesResponse.next_page_token}. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. + * @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 [CertificateAuthority]{@link google.cloud.security.privateca.v1beta1.CertificateAuthority} 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 `listCertificateAuthoritiesAsync()` + * 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. + */ + listCertificateAuthoritiesStream( + request?: protos.google.cloud.security.privateca.v1beta1.IListCertificateAuthoritiesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listCertificateAuthorities']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listCertificateAuthorities.createStream( + this.innerApiCalls.listCertificateAuthorities as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listCertificateAuthorities`, 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.security.privateca.v1beta1.CertificateAuthority|CertificateAuthorities}, in the format + * `projects/* /locations/*`. + * @param {number} [request.pageSize] + * Optional. Limit on the number of {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthorities} to + * include in the response. + * Further {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthorities} can subsequently be + * obtained by including the + * {@link google.cloud.security.privateca.v1beta1.ListCertificateAuthoritiesResponse.next_page_token|ListCertificateAuthoritiesResponse.next_page_token} in a subsequent + * request. If unspecified, the server will pick an appropriate default. + * @param {string} [request.pageToken] + * Optional. Pagination token, returned earlier via + * {@link google.cloud.security.privateca.v1beta1.ListCertificateAuthoritiesResponse.next_page_token|ListCertificateAuthoritiesResponse.next_page_token}. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. + * @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 + * [CertificateAuthority]{@link google.cloud.security.privateca.v1beta1.CertificateAuthority}. 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/v1beta1/certificate_authority_service.list_certificate_authorities.js + * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_ListCertificateAuthorities_async + */ + listCertificateAuthoritiesAsync( + request?: protos.google.cloud.security.privateca.v1beta1.IListCertificateAuthoritiesRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listCertificateAuthorities']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listCertificateAuthorities.asyncIterate( + this.innerApiCalls['listCertificateAuthorities'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + /** + * Lists {@link google.cloud.security.privateca.v1beta1.CertificateRevocationList|CertificateRevocationLists}. + * + * @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.security.privateca.v1beta1.CertificateRevocationList|CertificateRevocationLists}, in the format + * `projects/* /locations/* /certificateauthorities/*`. + * @param {number} [request.pageSize] + * Optional. Limit on the number of + * {@link google.cloud.security.privateca.v1beta1.CertificateRevocationList|CertificateRevocationLists} to include in the + * response. Further {@link google.cloud.security.privateca.v1beta1.CertificateRevocationList|CertificateRevocationLists} + * can subsequently be obtained by including the + * {@link google.cloud.security.privateca.v1beta1.ListCertificateRevocationListsResponse.next_page_token|ListCertificateRevocationListsResponse.next_page_token} in a subsequent + * request. If unspecified, the server will pick an appropriate default. + * @param {string} [request.pageToken] + * Optional. Pagination token, returned earlier via + * {@link google.cloud.security.privateca.v1beta1.ListCertificateRevocationListsResponse.next_page_token|ListCertificateRevocationListsResponse.next_page_token}. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [CertificateRevocationList]{@link google.cloud.security.privateca.v1beta1.CertificateRevocationList}. + * 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 `listCertificateRevocationListsAsync()` + * 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. + */ + listCertificateRevocationLists( + request?: protos.google.cloud.security.privateca.v1beta1.IListCertificateRevocationListsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.security.privateca.v1beta1.ICertificateRevocationList[], + protos.google.cloud.security.privateca.v1beta1.IListCertificateRevocationListsRequest|null, + protos.google.cloud.security.privateca.v1beta1.IListCertificateRevocationListsResponse + ]>; + listCertificateRevocationLists( + request: protos.google.cloud.security.privateca.v1beta1.IListCertificateRevocationListsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.security.privateca.v1beta1.IListCertificateRevocationListsRequest, + protos.google.cloud.security.privateca.v1beta1.IListCertificateRevocationListsResponse|null|undefined, + protos.google.cloud.security.privateca.v1beta1.ICertificateRevocationList>): void; + listCertificateRevocationLists( + request: protos.google.cloud.security.privateca.v1beta1.IListCertificateRevocationListsRequest, + callback: PaginationCallback< + protos.google.cloud.security.privateca.v1beta1.IListCertificateRevocationListsRequest, + protos.google.cloud.security.privateca.v1beta1.IListCertificateRevocationListsResponse|null|undefined, + protos.google.cloud.security.privateca.v1beta1.ICertificateRevocationList>): void; + listCertificateRevocationLists( + request?: protos.google.cloud.security.privateca.v1beta1.IListCertificateRevocationListsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.security.privateca.v1beta1.IListCertificateRevocationListsRequest, + protos.google.cloud.security.privateca.v1beta1.IListCertificateRevocationListsResponse|null|undefined, + protos.google.cloud.security.privateca.v1beta1.ICertificateRevocationList>, + callback?: PaginationCallback< + protos.google.cloud.security.privateca.v1beta1.IListCertificateRevocationListsRequest, + protos.google.cloud.security.privateca.v1beta1.IListCertificateRevocationListsResponse|null|undefined, + protos.google.cloud.security.privateca.v1beta1.ICertificateRevocationList>): + Promise<[ + protos.google.cloud.security.privateca.v1beta1.ICertificateRevocationList[], + protos.google.cloud.security.privateca.v1beta1.IListCertificateRevocationListsRequest|null, + protos.google.cloud.security.privateca.v1beta1.IListCertificateRevocationListsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listCertificateRevocationLists(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.security.privateca.v1beta1.CertificateRevocationList|CertificateRevocationLists}, in the format + * `projects/* /locations/* /certificateauthorities/*`. + * @param {number} [request.pageSize] + * Optional. Limit on the number of + * {@link google.cloud.security.privateca.v1beta1.CertificateRevocationList|CertificateRevocationLists} to include in the + * response. Further {@link google.cloud.security.privateca.v1beta1.CertificateRevocationList|CertificateRevocationLists} + * can subsequently be obtained by including the + * {@link google.cloud.security.privateca.v1beta1.ListCertificateRevocationListsResponse.next_page_token|ListCertificateRevocationListsResponse.next_page_token} in a subsequent + * request. If unspecified, the server will pick an appropriate default. + * @param {string} [request.pageToken] + * Optional. Pagination token, returned earlier via + * {@link google.cloud.security.privateca.v1beta1.ListCertificateRevocationListsResponse.next_page_token|ListCertificateRevocationListsResponse.next_page_token}. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. + * @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 [CertificateRevocationList]{@link google.cloud.security.privateca.v1beta1.CertificateRevocationList} 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 `listCertificateRevocationListsAsync()` + * 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. + */ + listCertificateRevocationListsStream( + request?: protos.google.cloud.security.privateca.v1beta1.IListCertificateRevocationListsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listCertificateRevocationLists']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listCertificateRevocationLists.createStream( + this.innerApiCalls.listCertificateRevocationLists as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listCertificateRevocationLists`, 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.security.privateca.v1beta1.CertificateRevocationList|CertificateRevocationLists}, in the format + * `projects/* /locations/* /certificateauthorities/*`. + * @param {number} [request.pageSize] + * Optional. Limit on the number of + * {@link google.cloud.security.privateca.v1beta1.CertificateRevocationList|CertificateRevocationLists} to include in the + * response. Further {@link google.cloud.security.privateca.v1beta1.CertificateRevocationList|CertificateRevocationLists} + * can subsequently be obtained by including the + * {@link google.cloud.security.privateca.v1beta1.ListCertificateRevocationListsResponse.next_page_token|ListCertificateRevocationListsResponse.next_page_token} in a subsequent + * request. If unspecified, the server will pick an appropriate default. + * @param {string} [request.pageToken] + * Optional. Pagination token, returned earlier via + * {@link google.cloud.security.privateca.v1beta1.ListCertificateRevocationListsResponse.next_page_token|ListCertificateRevocationListsResponse.next_page_token}. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. + * @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 + * [CertificateRevocationList]{@link google.cloud.security.privateca.v1beta1.CertificateRevocationList}. 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/v1beta1/certificate_authority_service.list_certificate_revocation_lists.js + * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_ListCertificateRevocationLists_async + */ + listCertificateRevocationListsAsync( + request?: protos.google.cloud.security.privateca.v1beta1.IListCertificateRevocationListsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listCertificateRevocationLists']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listCertificateRevocationLists.asyncIterate( + this.innerApiCalls['listCertificateRevocationLists'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + /** + * Lists {@link google.cloud.security.privateca.v1beta1.ReusableConfig|ReusableConfigs}. + * + * @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.security.privateca.v1beta1.ReusableConfig|ReusableConfigs}, in the format + * `projects/* /locations/*`. + * @param {number} [request.pageSize] + * Optional. Limit on the number of + * {@link google.cloud.security.privateca.v1beta1.ReusableConfig|ReusableConfigs} to include in the response. + * Further {@link google.cloud.security.privateca.v1beta1.ReusableConfig|ReusableConfigs} can subsequently be + * obtained by including the + * {@link google.cloud.security.privateca.v1beta1.ListReusableConfigsResponse.next_page_token|ListReusableConfigsResponse.next_page_token} in a subsequent request. If + * unspecified, the server will pick an appropriate default. + * @param {string} [request.pageToken] + * Optional. Pagination token, returned earlier via + * {@link google.cloud.security.privateca.v1beta1.ListReusableConfigsResponse.next_page_token|ListReusableConfigsResponse.next_page_token}. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [ReusableConfig]{@link google.cloud.security.privateca.v1beta1.ReusableConfig}. + * 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 `listReusableConfigsAsync()` + * 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. + */ + listReusableConfigs( + request?: protos.google.cloud.security.privateca.v1beta1.IListReusableConfigsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.security.privateca.v1beta1.IReusableConfig[], + protos.google.cloud.security.privateca.v1beta1.IListReusableConfigsRequest|null, + protos.google.cloud.security.privateca.v1beta1.IListReusableConfigsResponse + ]>; + listReusableConfigs( + request: protos.google.cloud.security.privateca.v1beta1.IListReusableConfigsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.security.privateca.v1beta1.IListReusableConfigsRequest, + protos.google.cloud.security.privateca.v1beta1.IListReusableConfigsResponse|null|undefined, + protos.google.cloud.security.privateca.v1beta1.IReusableConfig>): void; + listReusableConfigs( + request: protos.google.cloud.security.privateca.v1beta1.IListReusableConfigsRequest, + callback: PaginationCallback< + protos.google.cloud.security.privateca.v1beta1.IListReusableConfigsRequest, + protos.google.cloud.security.privateca.v1beta1.IListReusableConfigsResponse|null|undefined, + protos.google.cloud.security.privateca.v1beta1.IReusableConfig>): void; + listReusableConfigs( + request?: protos.google.cloud.security.privateca.v1beta1.IListReusableConfigsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.security.privateca.v1beta1.IListReusableConfigsRequest, + protos.google.cloud.security.privateca.v1beta1.IListReusableConfigsResponse|null|undefined, + protos.google.cloud.security.privateca.v1beta1.IReusableConfig>, + callback?: PaginationCallback< + protos.google.cloud.security.privateca.v1beta1.IListReusableConfigsRequest, + protos.google.cloud.security.privateca.v1beta1.IListReusableConfigsResponse|null|undefined, + protos.google.cloud.security.privateca.v1beta1.IReusableConfig>): + Promise<[ + protos.google.cloud.security.privateca.v1beta1.IReusableConfig[], + protos.google.cloud.security.privateca.v1beta1.IListReusableConfigsRequest|null, + protos.google.cloud.security.privateca.v1beta1.IListReusableConfigsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listReusableConfigs(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.security.privateca.v1beta1.ReusableConfig|ReusableConfigs}, in the format + * `projects/* /locations/*`. + * @param {number} [request.pageSize] + * Optional. Limit on the number of + * {@link google.cloud.security.privateca.v1beta1.ReusableConfig|ReusableConfigs} to include in the response. + * Further {@link google.cloud.security.privateca.v1beta1.ReusableConfig|ReusableConfigs} can subsequently be + * obtained by including the + * {@link google.cloud.security.privateca.v1beta1.ListReusableConfigsResponse.next_page_token|ListReusableConfigsResponse.next_page_token} in a subsequent request. If + * unspecified, the server will pick an appropriate default. + * @param {string} [request.pageToken] + * Optional. Pagination token, returned earlier via + * {@link google.cloud.security.privateca.v1beta1.ListReusableConfigsResponse.next_page_token|ListReusableConfigsResponse.next_page_token}. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. + * @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 [ReusableConfig]{@link google.cloud.security.privateca.v1beta1.ReusableConfig} 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 `listReusableConfigsAsync()` + * 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. + */ + listReusableConfigsStream( + request?: protos.google.cloud.security.privateca.v1beta1.IListReusableConfigsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listReusableConfigs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listReusableConfigs.createStream( + this.innerApiCalls.listReusableConfigs as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listReusableConfigs`, 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.security.privateca.v1beta1.ReusableConfig|ReusableConfigs}, in the format + * `projects/* /locations/*`. + * @param {number} [request.pageSize] + * Optional. Limit on the number of + * {@link google.cloud.security.privateca.v1beta1.ReusableConfig|ReusableConfigs} to include in the response. + * Further {@link google.cloud.security.privateca.v1beta1.ReusableConfig|ReusableConfigs} can subsequently be + * obtained by including the + * {@link google.cloud.security.privateca.v1beta1.ListReusableConfigsResponse.next_page_token|ListReusableConfigsResponse.next_page_token} in a subsequent request. If + * unspecified, the server will pick an appropriate default. + * @param {string} [request.pageToken] + * Optional. Pagination token, returned earlier via + * {@link google.cloud.security.privateca.v1beta1.ListReusableConfigsResponse.next_page_token|ListReusableConfigsResponse.next_page_token}. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. + * @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 + * [ReusableConfig]{@link google.cloud.security.privateca.v1beta1.ReusableConfig}. 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/v1beta1/certificate_authority_service.list_reusable_configs.js + * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_ListReusableConfigs_async + */ + listReusableConfigsAsync( + request?: protos.google.cloud.security.privateca.v1beta1.IListReusableConfigsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listReusableConfigs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listReusableConfigs.asyncIterate( + this.innerApiCalls['listReusableConfigs'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified certificate resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} certificate_authority + * @param {string} certificate + * @returns {string} Resource name string. + */ + certificatePath(project:string,location:string,certificateAuthority:string,certificate:string) { + return this.pathTemplates.certificatePathTemplate.render({ + project: project, + location: location, + certificate_authority: certificateAuthority, + certificate: certificate, + }); + } + + /** + * Parse the project from Certificate resource. + * + * @param {string} certificateName + * A fully-qualified path representing Certificate resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCertificateName(certificateName: string) { + return this.pathTemplates.certificatePathTemplate.match(certificateName).project; + } + + /** + * Parse the location from Certificate resource. + * + * @param {string} certificateName + * A fully-qualified path representing Certificate resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCertificateName(certificateName: string) { + return this.pathTemplates.certificatePathTemplate.match(certificateName).location; + } + + /** + * Parse the certificate_authority from Certificate resource. + * + * @param {string} certificateName + * A fully-qualified path representing Certificate resource. + * @returns {string} A string representing the certificate_authority. + */ + matchCertificateAuthorityFromCertificateName(certificateName: string) { + return this.pathTemplates.certificatePathTemplate.match(certificateName).certificate_authority; + } + + /** + * Parse the certificate from Certificate resource. + * + * @param {string} certificateName + * A fully-qualified path representing Certificate resource. + * @returns {string} A string representing the certificate. + */ + matchCertificateFromCertificateName(certificateName: string) { + return this.pathTemplates.certificatePathTemplate.match(certificateName).certificate; + } + + /** + * Return a fully-qualified certificateAuthority resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} certificate_authority + * @returns {string} Resource name string. + */ + certificateAuthorityPath(project:string,location:string,certificateAuthority:string) { + return this.pathTemplates.certificateAuthorityPathTemplate.render({ + project: project, + location: location, + certificate_authority: certificateAuthority, + }); + } + + /** + * Parse the project from CertificateAuthority resource. + * + * @param {string} certificateAuthorityName + * A fully-qualified path representing CertificateAuthority resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCertificateAuthorityName(certificateAuthorityName: string) { + return this.pathTemplates.certificateAuthorityPathTemplate.match(certificateAuthorityName).project; + } + + /** + * Parse the location from CertificateAuthority resource. + * + * @param {string} certificateAuthorityName + * A fully-qualified path representing CertificateAuthority resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCertificateAuthorityName(certificateAuthorityName: string) { + return this.pathTemplates.certificateAuthorityPathTemplate.match(certificateAuthorityName).location; + } + + /** + * Parse the certificate_authority from CertificateAuthority resource. + * + * @param {string} certificateAuthorityName + * A fully-qualified path representing CertificateAuthority resource. + * @returns {string} A string representing the certificate_authority. + */ + matchCertificateAuthorityFromCertificateAuthorityName(certificateAuthorityName: string) { + return this.pathTemplates.certificateAuthorityPathTemplate.match(certificateAuthorityName).certificate_authority; + } + + /** + * Return a fully-qualified certificateRevocationList resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} certificate_authority + * @param {string} certificate_revocation_list + * @returns {string} Resource name string. + */ + certificateRevocationListPath(project:string,location:string,certificateAuthority:string,certificateRevocationList:string) { + return this.pathTemplates.certificateRevocationListPathTemplate.render({ + project: project, + location: location, + certificate_authority: certificateAuthority, + certificate_revocation_list: certificateRevocationList, + }); + } + + /** + * Parse the project from CertificateRevocationList resource. + * + * @param {string} certificateRevocationListName + * A fully-qualified path representing CertificateRevocationList resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCertificateRevocationListName(certificateRevocationListName: string) { + return this.pathTemplates.certificateRevocationListPathTemplate.match(certificateRevocationListName).project; + } + + /** + * Parse the location from CertificateRevocationList resource. + * + * @param {string} certificateRevocationListName + * A fully-qualified path representing CertificateRevocationList resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCertificateRevocationListName(certificateRevocationListName: string) { + return this.pathTemplates.certificateRevocationListPathTemplate.match(certificateRevocationListName).location; + } + + /** + * Parse the certificate_authority from CertificateRevocationList resource. + * + * @param {string} certificateRevocationListName + * A fully-qualified path representing CertificateRevocationList resource. + * @returns {string} A string representing the certificate_authority. + */ + matchCertificateAuthorityFromCertificateRevocationListName(certificateRevocationListName: string) { + return this.pathTemplates.certificateRevocationListPathTemplate.match(certificateRevocationListName).certificate_authority; + } + + /** + * Parse the certificate_revocation_list from CertificateRevocationList resource. + * + * @param {string} certificateRevocationListName + * A fully-qualified path representing CertificateRevocationList resource. + * @returns {string} A string representing the certificate_revocation_list. + */ + matchCertificateRevocationListFromCertificateRevocationListName(certificateRevocationListName: string) { + return this.pathTemplates.certificateRevocationListPathTemplate.match(certificateRevocationListName).certificate_revocation_list; + } + + /** + * 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 reusableConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} reusable_config + * @returns {string} Resource name string. + */ + reusableConfigPath(project:string,location:string,reusableConfig:string) { + return this.pathTemplates.reusableConfigPathTemplate.render({ + project: project, + location: location, + reusable_config: reusableConfig, + }); + } + + /** + * Parse the project from ReusableConfig resource. + * + * @param {string} reusableConfigName + * A fully-qualified path representing ReusableConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromReusableConfigName(reusableConfigName: string) { + return this.pathTemplates.reusableConfigPathTemplate.match(reusableConfigName).project; + } + + /** + * Parse the location from ReusableConfig resource. + * + * @param {string} reusableConfigName + * A fully-qualified path representing ReusableConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromReusableConfigName(reusableConfigName: string) { + return this.pathTemplates.reusableConfigPathTemplate.match(reusableConfigName).location; + } + + /** + * Parse the reusable_config from ReusableConfig resource. + * + * @param {string} reusableConfigName + * A fully-qualified path representing ReusableConfig resource. + * @returns {string} A string representing the reusable_config. + */ + matchReusableConfigFromReusableConfigName(reusableConfigName: string) { + return this.pathTemplates.reusableConfigPathTemplate.match(reusableConfigName).reusable_config; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.certificateAuthorityServiceStub && !this._terminated) { + return this.certificateAuthorityServiceStub.then(stub => { + this._terminated = true; + stub.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v1beta1/src/v1beta1/certificate_authority_service_client_config.json b/owl-bot-staging/v1beta1/src/v1beta1/certificate_authority_service_client_config.json new file mode 100644 index 0000000..76b91dd --- /dev/null +++ b/owl-bot-staging/v1beta1/src/v1beta1/certificate_authority_service_client_config.json @@ -0,0 +1,131 @@ +{ + "interfaces": { + "google.cloud.security.privateca.v1beta1.CertificateAuthorityService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unknown_deadline_exceeded_unavailable": [ + "UNKNOWN", + "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": { + "CreateCertificate": { + "timeout_millis": 60000, + "retry_codes_name": "unknown_deadline_exceeded_unavailable", + "retry_params_name": "default" + }, + "GetCertificate": { + "timeout_millis": 60000, + "retry_codes_name": "unknown_deadline_exceeded_unavailable", + "retry_params_name": "default" + }, + "ListCertificates": { + "timeout_millis": 60000, + "retry_codes_name": "unknown_deadline_exceeded_unavailable", + "retry_params_name": "default" + }, + "RevokeCertificate": { + "timeout_millis": 60000, + "retry_codes_name": "unknown_deadline_exceeded_unavailable", + "retry_params_name": "default" + }, + "UpdateCertificate": { + "timeout_millis": 60000, + "retry_codes_name": "unknown_deadline_exceeded_unavailable", + "retry_params_name": "default" + }, + "ActivateCertificateAuthority": { + "timeout_millis": 60000, + "retry_codes_name": "unknown_deadline_exceeded_unavailable", + "retry_params_name": "default" + }, + "CreateCertificateAuthority": { + "timeout_millis": 60000, + "retry_codes_name": "unknown_deadline_exceeded_unavailable", + "retry_params_name": "default" + }, + "DisableCertificateAuthority": { + "timeout_millis": 60000, + "retry_codes_name": "unknown_deadline_exceeded_unavailable", + "retry_params_name": "default" + }, + "EnableCertificateAuthority": { + "timeout_millis": 60000, + "retry_codes_name": "unknown_deadline_exceeded_unavailable", + "retry_params_name": "default" + }, + "FetchCertificateAuthorityCsr": { + "timeout_millis": 60000, + "retry_codes_name": "unknown_deadline_exceeded_unavailable", + "retry_params_name": "default" + }, + "GetCertificateAuthority": { + "timeout_millis": 60000, + "retry_codes_name": "unknown_deadline_exceeded_unavailable", + "retry_params_name": "default" + }, + "ListCertificateAuthorities": { + "timeout_millis": 60000, + "retry_codes_name": "unknown_deadline_exceeded_unavailable", + "retry_params_name": "default" + }, + "RestoreCertificateAuthority": { + "timeout_millis": 60000, + "retry_codes_name": "unknown_deadline_exceeded_unavailable", + "retry_params_name": "default" + }, + "ScheduleDeleteCertificateAuthority": { + "timeout_millis": 60000, + "retry_codes_name": "unknown_deadline_exceeded_unavailable", + "retry_params_name": "default" + }, + "UpdateCertificateAuthority": { + "timeout_millis": 60000, + "retry_codes_name": "unknown_deadline_exceeded_unavailable", + "retry_params_name": "default" + }, + "GetCertificateRevocationList": { + "timeout_millis": 60000, + "retry_codes_name": "unknown_deadline_exceeded_unavailable", + "retry_params_name": "default" + }, + "ListCertificateRevocationLists": { + "timeout_millis": 60000, + "retry_codes_name": "unknown_deadline_exceeded_unavailable", + "retry_params_name": "default" + }, + "UpdateCertificateRevocationList": { + "timeout_millis": 60000, + "retry_codes_name": "unknown_deadline_exceeded_unavailable", + "retry_params_name": "default" + }, + "GetReusableConfig": { + "timeout_millis": 60000, + "retry_codes_name": "unknown_deadline_exceeded_unavailable", + "retry_params_name": "default" + }, + "ListReusableConfigs": { + "timeout_millis": 60000, + "retry_codes_name": "unknown_deadline_exceeded_unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v1beta1/src/v1beta1/certificate_authority_service_proto_list.json b/owl-bot-staging/v1beta1/src/v1beta1/certificate_authority_service_proto_list.json new file mode 100644 index 0000000..746af90 --- /dev/null +++ b/owl-bot-staging/v1beta1/src/v1beta1/certificate_authority_service_proto_list.json @@ -0,0 +1,4 @@ +[ + "../../protos/google/cloud/security/privateca/v1beta1/resources.proto", + "../../protos/google/cloud/security/privateca/v1beta1/service.proto" +] diff --git a/owl-bot-staging/v1beta1/src/v1beta1/gapic_metadata.json b/owl-bot-staging/v1beta1/src/v1beta1/gapic_metadata.json new file mode 100644 index 0000000..79c7f39 --- /dev/null +++ b/owl-bot-staging/v1beta1/src/v1beta1/gapic_metadata.json @@ -0,0 +1,239 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.security.privateca.v1beta1", + "libraryPackage": "@google-cloud/security-private-ca", + "services": { + "CertificateAuthorityService": { + "clients": { + "grpc": { + "libraryClient": "CertificateAuthorityServiceClient", + "rpcs": { + "CreateCertificate": { + "methods": [ + "createCertificate" + ] + }, + "GetCertificate": { + "methods": [ + "getCertificate" + ] + }, + "RevokeCertificate": { + "methods": [ + "revokeCertificate" + ] + }, + "UpdateCertificate": { + "methods": [ + "updateCertificate" + ] + }, + "FetchCertificateAuthorityCsr": { + "methods": [ + "fetchCertificateAuthorityCsr" + ] + }, + "GetCertificateAuthority": { + "methods": [ + "getCertificateAuthority" + ] + }, + "GetCertificateRevocationList": { + "methods": [ + "getCertificateRevocationList" + ] + }, + "GetReusableConfig": { + "methods": [ + "getReusableConfig" + ] + }, + "ActivateCertificateAuthority": { + "methods": [ + "activateCertificateAuthority" + ] + }, + "CreateCertificateAuthority": { + "methods": [ + "createCertificateAuthority" + ] + }, + "DisableCertificateAuthority": { + "methods": [ + "disableCertificateAuthority" + ] + }, + "EnableCertificateAuthority": { + "methods": [ + "enableCertificateAuthority" + ] + }, + "RestoreCertificateAuthority": { + "methods": [ + "restoreCertificateAuthority" + ] + }, + "ScheduleDeleteCertificateAuthority": { + "methods": [ + "scheduleDeleteCertificateAuthority" + ] + }, + "UpdateCertificateAuthority": { + "methods": [ + "updateCertificateAuthority" + ] + }, + "UpdateCertificateRevocationList": { + "methods": [ + "updateCertificateRevocationList" + ] + }, + "ListCertificates": { + "methods": [ + "listCertificates", + "listCertificatesStream", + "listCertificatesAsync" + ] + }, + "ListCertificateAuthorities": { + "methods": [ + "listCertificateAuthorities", + "listCertificateAuthoritiesStream", + "listCertificateAuthoritiesAsync" + ] + }, + "ListCertificateRevocationLists": { + "methods": [ + "listCertificateRevocationLists", + "listCertificateRevocationListsStream", + "listCertificateRevocationListsAsync" + ] + }, + "ListReusableConfigs": { + "methods": [ + "listReusableConfigs", + "listReusableConfigsStream", + "listReusableConfigsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "CertificateAuthorityServiceClient", + "rpcs": { + "CreateCertificate": { + "methods": [ + "createCertificate" + ] + }, + "GetCertificate": { + "methods": [ + "getCertificate" + ] + }, + "RevokeCertificate": { + "methods": [ + "revokeCertificate" + ] + }, + "UpdateCertificate": { + "methods": [ + "updateCertificate" + ] + }, + "FetchCertificateAuthorityCsr": { + "methods": [ + "fetchCertificateAuthorityCsr" + ] + }, + "GetCertificateAuthority": { + "methods": [ + "getCertificateAuthority" + ] + }, + "GetCertificateRevocationList": { + "methods": [ + "getCertificateRevocationList" + ] + }, + "GetReusableConfig": { + "methods": [ + "getReusableConfig" + ] + }, + "ActivateCertificateAuthority": { + "methods": [ + "activateCertificateAuthority" + ] + }, + "CreateCertificateAuthority": { + "methods": [ + "createCertificateAuthority" + ] + }, + "DisableCertificateAuthority": { + "methods": [ + "disableCertificateAuthority" + ] + }, + "EnableCertificateAuthority": { + "methods": [ + "enableCertificateAuthority" + ] + }, + "RestoreCertificateAuthority": { + "methods": [ + "restoreCertificateAuthority" + ] + }, + "ScheduleDeleteCertificateAuthority": { + "methods": [ + "scheduleDeleteCertificateAuthority" + ] + }, + "UpdateCertificateAuthority": { + "methods": [ + "updateCertificateAuthority" + ] + }, + "UpdateCertificateRevocationList": { + "methods": [ + "updateCertificateRevocationList" + ] + }, + "ListCertificates": { + "methods": [ + "listCertificates", + "listCertificatesStream", + "listCertificatesAsync" + ] + }, + "ListCertificateAuthorities": { + "methods": [ + "listCertificateAuthorities", + "listCertificateAuthoritiesStream", + "listCertificateAuthoritiesAsync" + ] + }, + "ListCertificateRevocationLists": { + "methods": [ + "listCertificateRevocationLists", + "listCertificateRevocationListsStream", + "listCertificateRevocationListsAsync" + ] + }, + "ListReusableConfigs": { + "methods": [ + "listReusableConfigs", + "listReusableConfigsStream", + "listReusableConfigsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/v1beta1/src/v1beta1/index.ts b/owl-bot-staging/v1beta1/src/v1beta1/index.ts new file mode 100644 index 0000000..846c95b --- /dev/null +++ b/owl-bot-staging/v1beta1/src/v1beta1/index.ts @@ -0,0 +1,19 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +export {CertificateAuthorityServiceClient} from './certificate_authority_service_client'; diff --git a/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.js new file mode 100644 index 0000000..8d0d0f8 --- /dev/null +++ b/owl-bot-staging/v1beta1/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 privateca = require('@google-cloud/security-private-ca'); + +function main() { + const certificateAuthorityServiceClient = new privateca.CertificateAuthorityServiceClient(); +} + +main(); diff --git a/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 0000000..445ab31 --- /dev/null +++ b/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,32 @@ +// 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 {CertificateAuthorityServiceClient} from '@google-cloud/security-private-ca'; + +// check that the client class type name can be used +function doStuffWithCertificateAuthorityServiceClient(client: CertificateAuthorityServiceClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const certificateAuthorityServiceClient = new CertificateAuthorityServiceClient(); + doStuffWithCertificateAuthorityServiceClient(certificateAuthorityServiceClient); +} + +main(); diff --git a/owl-bot-staging/v1beta1/system-test/install.ts b/owl-bot-staging/v1beta1/system-test/install.ts new file mode 100644 index 0000000..8ec4522 --- /dev/null +++ b/owl-bot-staging/v1beta1/system-test/install.ts @@ -0,0 +1,49 @@ +// 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/owl-bot-staging/v1beta1/test/gapic_certificate_authority_service_v1beta1.ts b/owl-bot-staging/v1beta1/test/gapic_certificate_authority_service_v1beta1.ts new file mode 100644 index 0000000..df438b7 --- /dev/null +++ b/owl-bot-staging/v1beta1/test/gapic_certificate_authority_service_v1beta1.ts @@ -0,0 +1,3271 @@ +// 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 certificateauthorityserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1beta1.CertificateAuthorityServiceClient', () => { + it('has servicePath', () => { + const servicePath = certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.certificateAuthorityServiceStub, undefined); + await client.initialize(); + assert(client.certificateAuthorityServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.certificateAuthorityServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.certificateAuthorityServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + 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 certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + 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('createCertificate', () => { + it('invokes createCertificate without error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CreateCertificateRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.Certificate()); + client.innerApiCalls.createCertificate = stubSimpleCall(expectedResponse); + const [response] = await client.createCertificate(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createCertificate as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createCertificate without error using callback', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CreateCertificateRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.Certificate()); + client.innerApiCalls.createCertificate = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createCertificate( + request, + (err?: Error|null, result?: protos.google.cloud.security.privateca.v1beta1.ICertificate|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createCertificate as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createCertificate with error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CreateCertificateRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createCertificate = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createCertificate(request), expectedError); + assert((client.innerApiCalls.createCertificate as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createCertificate with closed client', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CreateCertificateRequest()); + request.parent = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createCertificate(request), expectedError); + }); + }); + + describe('getCertificate', () => { + it('invokes getCertificate without error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.GetCertificateRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.Certificate()); + client.innerApiCalls.getCertificate = stubSimpleCall(expectedResponse); + const [response] = await client.getCertificate(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getCertificate as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getCertificate without error using callback', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.GetCertificateRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.Certificate()); + client.innerApiCalls.getCertificate = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getCertificate( + request, + (err?: Error|null, result?: protos.google.cloud.security.privateca.v1beta1.ICertificate|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getCertificate as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getCertificate with error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.GetCertificateRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getCertificate = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getCertificate(request), expectedError); + assert((client.innerApiCalls.getCertificate as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getCertificate with closed client', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.GetCertificateRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getCertificate(request), expectedError); + }); + }); + + describe('revokeCertificate', () => { + it('invokes revokeCertificate without error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.RevokeCertificateRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.Certificate()); + client.innerApiCalls.revokeCertificate = stubSimpleCall(expectedResponse); + const [response] = await client.revokeCertificate(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.revokeCertificate as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes revokeCertificate without error using callback', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.RevokeCertificateRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.Certificate()); + client.innerApiCalls.revokeCertificate = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.revokeCertificate( + request, + (err?: Error|null, result?: protos.google.cloud.security.privateca.v1beta1.ICertificate|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.revokeCertificate as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes revokeCertificate with error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.RevokeCertificateRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.revokeCertificate = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.revokeCertificate(request), expectedError); + assert((client.innerApiCalls.revokeCertificate as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes revokeCertificate with closed client', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.RevokeCertificateRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.revokeCertificate(request), expectedError); + }); + }); + + describe('updateCertificate', () => { + it('invokes updateCertificate without error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.UpdateCertificateRequest()); + request.certificate = {}; + request.certificate.name = ''; + const expectedHeaderRequestParams = "certificate.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.Certificate()); + client.innerApiCalls.updateCertificate = stubSimpleCall(expectedResponse); + const [response] = await client.updateCertificate(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateCertificate as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateCertificate without error using callback', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.UpdateCertificateRequest()); + request.certificate = {}; + request.certificate.name = ''; + const expectedHeaderRequestParams = "certificate.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.Certificate()); + client.innerApiCalls.updateCertificate = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateCertificate( + request, + (err?: Error|null, result?: protos.google.cloud.security.privateca.v1beta1.ICertificate|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateCertificate as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateCertificate with error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.UpdateCertificateRequest()); + request.certificate = {}; + request.certificate.name = ''; + const expectedHeaderRequestParams = "certificate.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateCertificate = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateCertificate(request), expectedError); + assert((client.innerApiCalls.updateCertificate as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateCertificate with closed client', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.UpdateCertificateRequest()); + request.certificate = {}; + request.certificate.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateCertificate(request), expectedError); + }); + }); + + describe('fetchCertificateAuthorityCsr', () => { + it('invokes fetchCertificateAuthorityCsr without error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.FetchCertificateAuthorityCsrRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.FetchCertificateAuthorityCsrResponse()); + client.innerApiCalls.fetchCertificateAuthorityCsr = stubSimpleCall(expectedResponse); + const [response] = await client.fetchCertificateAuthorityCsr(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.fetchCertificateAuthorityCsr as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes fetchCertificateAuthorityCsr without error using callback', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.FetchCertificateAuthorityCsrRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.FetchCertificateAuthorityCsrResponse()); + client.innerApiCalls.fetchCertificateAuthorityCsr = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.fetchCertificateAuthorityCsr( + request, + (err?: Error|null, result?: protos.google.cloud.security.privateca.v1beta1.IFetchCertificateAuthorityCsrResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.fetchCertificateAuthorityCsr as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes fetchCertificateAuthorityCsr with error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.FetchCertificateAuthorityCsrRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.fetchCertificateAuthorityCsr = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.fetchCertificateAuthorityCsr(request), expectedError); + assert((client.innerApiCalls.fetchCertificateAuthorityCsr as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes fetchCertificateAuthorityCsr with closed client', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.FetchCertificateAuthorityCsrRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.fetchCertificateAuthorityCsr(request), expectedError); + }); + }); + + describe('getCertificateAuthority', () => { + it('invokes getCertificateAuthority without error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.GetCertificateAuthorityRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateAuthority()); + client.innerApiCalls.getCertificateAuthority = stubSimpleCall(expectedResponse); + const [response] = await client.getCertificateAuthority(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getCertificateAuthority without error using callback', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.GetCertificateAuthorityRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateAuthority()); + client.innerApiCalls.getCertificateAuthority = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getCertificateAuthority( + request, + (err?: Error|null, result?: protos.google.cloud.security.privateca.v1beta1.ICertificateAuthority|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getCertificateAuthority with error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.GetCertificateAuthorityRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getCertificateAuthority = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getCertificateAuthority(request), expectedError); + assert((client.innerApiCalls.getCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getCertificateAuthority with closed client', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.GetCertificateAuthorityRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getCertificateAuthority(request), expectedError); + }); + }); + + describe('getCertificateRevocationList', () => { + it('invokes getCertificateRevocationList without error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.GetCertificateRevocationListRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateRevocationList()); + client.innerApiCalls.getCertificateRevocationList = stubSimpleCall(expectedResponse); + const [response] = await client.getCertificateRevocationList(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getCertificateRevocationList as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getCertificateRevocationList without error using callback', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.GetCertificateRevocationListRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateRevocationList()); + client.innerApiCalls.getCertificateRevocationList = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getCertificateRevocationList( + request, + (err?: Error|null, result?: protos.google.cloud.security.privateca.v1beta1.ICertificateRevocationList|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getCertificateRevocationList as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getCertificateRevocationList with error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.GetCertificateRevocationListRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getCertificateRevocationList = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getCertificateRevocationList(request), expectedError); + assert((client.innerApiCalls.getCertificateRevocationList as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getCertificateRevocationList with closed client', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.GetCertificateRevocationListRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getCertificateRevocationList(request), expectedError); + }); + }); + + describe('getReusableConfig', () => { + it('invokes getReusableConfig without error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.GetReusableConfigRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ReusableConfig()); + client.innerApiCalls.getReusableConfig = stubSimpleCall(expectedResponse); + const [response] = await client.getReusableConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getReusableConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getReusableConfig without error using callback', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.GetReusableConfigRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ReusableConfig()); + client.innerApiCalls.getReusableConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getReusableConfig( + request, + (err?: Error|null, result?: protos.google.cloud.security.privateca.v1beta1.IReusableConfig|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getReusableConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getReusableConfig with error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.GetReusableConfigRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getReusableConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getReusableConfig(request), expectedError); + assert((client.innerApiCalls.getReusableConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getReusableConfig with closed client', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.GetReusableConfigRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getReusableConfig(request), expectedError); + }); + }); + + describe('activateCertificateAuthority', () => { + it('invokes activateCertificateAuthority without error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ActivateCertificateAuthorityRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.activateCertificateAuthority = stubLongRunningCall(expectedResponse); + const [operation] = await client.activateCertificateAuthority(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.activateCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes activateCertificateAuthority without error using callback', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ActivateCertificateAuthorityRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.activateCertificateAuthority = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.activateCertificateAuthority( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.activateCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes activateCertificateAuthority with call error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ActivateCertificateAuthorityRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.activateCertificateAuthority = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.activateCertificateAuthority(request), expectedError); + assert((client.innerApiCalls.activateCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes activateCertificateAuthority with LRO error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ActivateCertificateAuthorityRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.activateCertificateAuthority = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.activateCertificateAuthority(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.activateCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkActivateCertificateAuthorityProgress without error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkActivateCertificateAuthorityProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkActivateCertificateAuthorityProgress with error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkActivateCertificateAuthorityProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createCertificateAuthority', () => { + it('invokes createCertificateAuthority without error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CreateCertificateAuthorityRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createCertificateAuthority = stubLongRunningCall(expectedResponse); + const [operation] = await client.createCertificateAuthority(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createCertificateAuthority without error using callback', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CreateCertificateAuthorityRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createCertificateAuthority = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createCertificateAuthority( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createCertificateAuthority with call error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CreateCertificateAuthorityRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createCertificateAuthority = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createCertificateAuthority(request), expectedError); + assert((client.innerApiCalls.createCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createCertificateAuthority with LRO error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CreateCertificateAuthorityRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createCertificateAuthority = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createCertificateAuthority(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.createCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkCreateCertificateAuthorityProgress without error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateCertificateAuthorityProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateCertificateAuthorityProgress with error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateCertificateAuthorityProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('disableCertificateAuthority', () => { + it('invokes disableCertificateAuthority without error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.DisableCertificateAuthorityRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.disableCertificateAuthority = stubLongRunningCall(expectedResponse); + const [operation] = await client.disableCertificateAuthority(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.disableCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes disableCertificateAuthority without error using callback', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.DisableCertificateAuthorityRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.disableCertificateAuthority = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.disableCertificateAuthority( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.disableCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes disableCertificateAuthority with call error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.DisableCertificateAuthorityRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.disableCertificateAuthority = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.disableCertificateAuthority(request), expectedError); + assert((client.innerApiCalls.disableCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes disableCertificateAuthority with LRO error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.DisableCertificateAuthorityRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.disableCertificateAuthority = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.disableCertificateAuthority(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.disableCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkDisableCertificateAuthorityProgress without error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDisableCertificateAuthorityProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDisableCertificateAuthorityProgress with error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDisableCertificateAuthorityProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('enableCertificateAuthority', () => { + it('invokes enableCertificateAuthority without error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.EnableCertificateAuthorityRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.enableCertificateAuthority = stubLongRunningCall(expectedResponse); + const [operation] = await client.enableCertificateAuthority(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.enableCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes enableCertificateAuthority without error using callback', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.EnableCertificateAuthorityRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.enableCertificateAuthority = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.enableCertificateAuthority( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.enableCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes enableCertificateAuthority with call error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.EnableCertificateAuthorityRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.enableCertificateAuthority = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.enableCertificateAuthority(request), expectedError); + assert((client.innerApiCalls.enableCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes enableCertificateAuthority with LRO error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.EnableCertificateAuthorityRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.enableCertificateAuthority = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.enableCertificateAuthority(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.enableCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkEnableCertificateAuthorityProgress without error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkEnableCertificateAuthorityProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkEnableCertificateAuthorityProgress with error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkEnableCertificateAuthorityProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('restoreCertificateAuthority', () => { + it('invokes restoreCertificateAuthority without error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.RestoreCertificateAuthorityRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.restoreCertificateAuthority = stubLongRunningCall(expectedResponse); + const [operation] = await client.restoreCertificateAuthority(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.restoreCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes restoreCertificateAuthority without error using callback', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.RestoreCertificateAuthorityRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.restoreCertificateAuthority = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.restoreCertificateAuthority( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.restoreCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes restoreCertificateAuthority with call error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.RestoreCertificateAuthorityRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.restoreCertificateAuthority = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.restoreCertificateAuthority(request), expectedError); + assert((client.innerApiCalls.restoreCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes restoreCertificateAuthority with LRO error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.RestoreCertificateAuthorityRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.restoreCertificateAuthority = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.restoreCertificateAuthority(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.restoreCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkRestoreCertificateAuthorityProgress without error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkRestoreCertificateAuthorityProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkRestoreCertificateAuthorityProgress with error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkRestoreCertificateAuthorityProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('scheduleDeleteCertificateAuthority', () => { + it('invokes scheduleDeleteCertificateAuthority without error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ScheduleDeleteCertificateAuthorityRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.scheduleDeleteCertificateAuthority = stubLongRunningCall(expectedResponse); + const [operation] = await client.scheduleDeleteCertificateAuthority(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.scheduleDeleteCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes scheduleDeleteCertificateAuthority without error using callback', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ScheduleDeleteCertificateAuthorityRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.scheduleDeleteCertificateAuthority = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.scheduleDeleteCertificateAuthority( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.scheduleDeleteCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes scheduleDeleteCertificateAuthority with call error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ScheduleDeleteCertificateAuthorityRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.scheduleDeleteCertificateAuthority = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.scheduleDeleteCertificateAuthority(request), expectedError); + assert((client.innerApiCalls.scheduleDeleteCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes scheduleDeleteCertificateAuthority with LRO error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ScheduleDeleteCertificateAuthorityRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.scheduleDeleteCertificateAuthority = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.scheduleDeleteCertificateAuthority(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.scheduleDeleteCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkScheduleDeleteCertificateAuthorityProgress without error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkScheduleDeleteCertificateAuthorityProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkScheduleDeleteCertificateAuthorityProgress with error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkScheduleDeleteCertificateAuthorityProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateCertificateAuthority', () => { + it('invokes updateCertificateAuthority without error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.UpdateCertificateAuthorityRequest()); + request.certificateAuthority = {}; + request.certificateAuthority.name = ''; + const expectedHeaderRequestParams = "certificate_authority.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.updateCertificateAuthority = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateCertificateAuthority(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateCertificateAuthority without error using callback', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.UpdateCertificateAuthorityRequest()); + request.certificateAuthority = {}; + request.certificateAuthority.name = ''; + const expectedHeaderRequestParams = "certificate_authority.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.updateCertificateAuthority = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateCertificateAuthority( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateCertificateAuthority with call error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.UpdateCertificateAuthorityRequest()); + request.certificateAuthority = {}; + request.certificateAuthority.name = ''; + const expectedHeaderRequestParams = "certificate_authority.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateCertificateAuthority = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateCertificateAuthority(request), expectedError); + assert((client.innerApiCalls.updateCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateCertificateAuthority with LRO error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.UpdateCertificateAuthorityRequest()); + request.certificateAuthority = {}; + request.certificateAuthority.name = ''; + const expectedHeaderRequestParams = "certificate_authority.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateCertificateAuthority = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateCertificateAuthority(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.updateCertificateAuthority as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkUpdateCertificateAuthorityProgress without error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateCertificateAuthorityProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateCertificateAuthorityProgress with error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateCertificateAuthorityProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateCertificateRevocationList', () => { + it('invokes updateCertificateRevocationList without error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.UpdateCertificateRevocationListRequest()); + request.certificateRevocationList = {}; + request.certificateRevocationList.name = ''; + const expectedHeaderRequestParams = "certificate_revocation_list.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.updateCertificateRevocationList = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateCertificateRevocationList(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateCertificateRevocationList as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateCertificateRevocationList without error using callback', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.UpdateCertificateRevocationListRequest()); + request.certificateRevocationList = {}; + request.certificateRevocationList.name = ''; + const expectedHeaderRequestParams = "certificate_revocation_list.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.updateCertificateRevocationList = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateCertificateRevocationList( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateCertificateRevocationList as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateCertificateRevocationList with call error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.UpdateCertificateRevocationListRequest()); + request.certificateRevocationList = {}; + request.certificateRevocationList.name = ''; + const expectedHeaderRequestParams = "certificate_revocation_list.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateCertificateRevocationList = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateCertificateRevocationList(request), expectedError); + assert((client.innerApiCalls.updateCertificateRevocationList as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateCertificateRevocationList with LRO error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.UpdateCertificateRevocationListRequest()); + request.certificateRevocationList = {}; + request.certificateRevocationList.name = ''; + const expectedHeaderRequestParams = "certificate_revocation_list.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateCertificateRevocationList = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateCertificateRevocationList(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.updateCertificateRevocationList as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkUpdateCertificateRevocationListProgress without error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateCertificateRevocationListProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateCertificateRevocationListProgress with error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateCertificateRevocationListProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listCertificates', () => { + it('invokes listCertificates without error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListCertificatesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.Certificate()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.Certificate()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.Certificate()), + ]; + client.innerApiCalls.listCertificates = stubSimpleCall(expectedResponse); + const [response] = await client.listCertificates(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listCertificates as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listCertificates without error using callback', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListCertificatesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.Certificate()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.Certificate()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.Certificate()), + ]; + client.innerApiCalls.listCertificates = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listCertificates( + request, + (err?: Error|null, result?: protos.google.cloud.security.privateca.v1beta1.ICertificate[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listCertificates as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listCertificates with error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListCertificatesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listCertificates = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listCertificates(request), expectedError); + assert((client.innerApiCalls.listCertificates as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listCertificatesStream without error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListCertificatesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.Certificate()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.Certificate()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.Certificate()), + ]; + client.descriptors.page.listCertificates.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listCertificatesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.security.privateca.v1beta1.Certificate[] = []; + stream.on('data', (response: protos.google.cloud.security.privateca.v1beta1.Certificate) => { + 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.listCertificates.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listCertificates, request)); + assert.strictEqual( + (client.descriptors.page.listCertificates.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listCertificatesStream with error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListCertificatesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listCertificates.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listCertificatesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.security.privateca.v1beta1.Certificate[] = []; + stream.on('data', (response: protos.google.cloud.security.privateca.v1beta1.Certificate) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listCertificates.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listCertificates, request)); + assert.strictEqual( + (client.descriptors.page.listCertificates.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listCertificates without error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListCertificatesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.Certificate()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.Certificate()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.Certificate()), + ]; + client.descriptors.page.listCertificates.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.security.privateca.v1beta1.ICertificate[] = []; + const iterable = client.listCertificatesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listCertificates.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listCertificates.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listCertificates with error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListCertificatesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listCertificates.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listCertificatesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.security.privateca.v1beta1.ICertificate[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listCertificates.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listCertificates.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listCertificateAuthorities', () => { + it('invokes listCertificateAuthorities without error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListCertificateAuthoritiesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateAuthority()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateAuthority()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateAuthority()), + ]; + client.innerApiCalls.listCertificateAuthorities = stubSimpleCall(expectedResponse); + const [response] = await client.listCertificateAuthorities(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listCertificateAuthorities as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listCertificateAuthorities without error using callback', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListCertificateAuthoritiesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateAuthority()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateAuthority()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateAuthority()), + ]; + client.innerApiCalls.listCertificateAuthorities = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listCertificateAuthorities( + request, + (err?: Error|null, result?: protos.google.cloud.security.privateca.v1beta1.ICertificateAuthority[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listCertificateAuthorities as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listCertificateAuthorities with error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListCertificateAuthoritiesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listCertificateAuthorities = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listCertificateAuthorities(request), expectedError); + assert((client.innerApiCalls.listCertificateAuthorities as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listCertificateAuthoritiesStream without error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListCertificateAuthoritiesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateAuthority()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateAuthority()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateAuthority()), + ]; + client.descriptors.page.listCertificateAuthorities.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listCertificateAuthoritiesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.security.privateca.v1beta1.CertificateAuthority[] = []; + stream.on('data', (response: protos.google.cloud.security.privateca.v1beta1.CertificateAuthority) => { + 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.listCertificateAuthorities.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listCertificateAuthorities, request)); + assert.strictEqual( + (client.descriptors.page.listCertificateAuthorities.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listCertificateAuthoritiesStream with error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListCertificateAuthoritiesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listCertificateAuthorities.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listCertificateAuthoritiesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.security.privateca.v1beta1.CertificateAuthority[] = []; + stream.on('data', (response: protos.google.cloud.security.privateca.v1beta1.CertificateAuthority) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listCertificateAuthorities.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listCertificateAuthorities, request)); + assert.strictEqual( + (client.descriptors.page.listCertificateAuthorities.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listCertificateAuthorities without error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListCertificateAuthoritiesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateAuthority()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateAuthority()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateAuthority()), + ]; + client.descriptors.page.listCertificateAuthorities.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.security.privateca.v1beta1.ICertificateAuthority[] = []; + const iterable = client.listCertificateAuthoritiesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listCertificateAuthorities.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listCertificateAuthorities.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listCertificateAuthorities with error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListCertificateAuthoritiesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listCertificateAuthorities.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listCertificateAuthoritiesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.security.privateca.v1beta1.ICertificateAuthority[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listCertificateAuthorities.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listCertificateAuthorities.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listCertificateRevocationLists', () => { + it('invokes listCertificateRevocationLists without error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListCertificateRevocationListsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateRevocationList()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateRevocationList()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateRevocationList()), + ]; + client.innerApiCalls.listCertificateRevocationLists = stubSimpleCall(expectedResponse); + const [response] = await client.listCertificateRevocationLists(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listCertificateRevocationLists as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listCertificateRevocationLists without error using callback', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListCertificateRevocationListsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateRevocationList()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateRevocationList()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateRevocationList()), + ]; + client.innerApiCalls.listCertificateRevocationLists = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listCertificateRevocationLists( + request, + (err?: Error|null, result?: protos.google.cloud.security.privateca.v1beta1.ICertificateRevocationList[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listCertificateRevocationLists as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listCertificateRevocationLists with error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListCertificateRevocationListsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listCertificateRevocationLists = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listCertificateRevocationLists(request), expectedError); + assert((client.innerApiCalls.listCertificateRevocationLists as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listCertificateRevocationListsStream without error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListCertificateRevocationListsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateRevocationList()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateRevocationList()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateRevocationList()), + ]; + client.descriptors.page.listCertificateRevocationLists.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listCertificateRevocationListsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.security.privateca.v1beta1.CertificateRevocationList[] = []; + stream.on('data', (response: protos.google.cloud.security.privateca.v1beta1.CertificateRevocationList) => { + 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.listCertificateRevocationLists.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listCertificateRevocationLists, request)); + assert.strictEqual( + (client.descriptors.page.listCertificateRevocationLists.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listCertificateRevocationListsStream with error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListCertificateRevocationListsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listCertificateRevocationLists.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listCertificateRevocationListsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.security.privateca.v1beta1.CertificateRevocationList[] = []; + stream.on('data', (response: protos.google.cloud.security.privateca.v1beta1.CertificateRevocationList) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listCertificateRevocationLists.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listCertificateRevocationLists, request)); + assert.strictEqual( + (client.descriptors.page.listCertificateRevocationLists.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listCertificateRevocationLists without error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListCertificateRevocationListsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateRevocationList()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateRevocationList()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateRevocationList()), + ]; + client.descriptors.page.listCertificateRevocationLists.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.security.privateca.v1beta1.ICertificateRevocationList[] = []; + const iterable = client.listCertificateRevocationListsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listCertificateRevocationLists.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listCertificateRevocationLists.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listCertificateRevocationLists with error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListCertificateRevocationListsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listCertificateRevocationLists.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listCertificateRevocationListsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.security.privateca.v1beta1.ICertificateRevocationList[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listCertificateRevocationLists.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listCertificateRevocationLists.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listReusableConfigs', () => { + it('invokes listReusableConfigs without error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListReusableConfigsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ReusableConfig()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ReusableConfig()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ReusableConfig()), + ]; + client.innerApiCalls.listReusableConfigs = stubSimpleCall(expectedResponse); + const [response] = await client.listReusableConfigs(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listReusableConfigs as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listReusableConfigs without error using callback', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListReusableConfigsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ReusableConfig()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ReusableConfig()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ReusableConfig()), + ]; + client.innerApiCalls.listReusableConfigs = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listReusableConfigs( + request, + (err?: Error|null, result?: protos.google.cloud.security.privateca.v1beta1.IReusableConfig[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listReusableConfigs as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listReusableConfigs with error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListReusableConfigsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listReusableConfigs = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listReusableConfigs(request), expectedError); + assert((client.innerApiCalls.listReusableConfigs as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listReusableConfigsStream without error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListReusableConfigsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ReusableConfig()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ReusableConfig()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ReusableConfig()), + ]; + client.descriptors.page.listReusableConfigs.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listReusableConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.security.privateca.v1beta1.ReusableConfig[] = []; + stream.on('data', (response: protos.google.cloud.security.privateca.v1beta1.ReusableConfig) => { + 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.listReusableConfigs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listReusableConfigs, request)); + assert.strictEqual( + (client.descriptors.page.listReusableConfigs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listReusableConfigsStream with error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListReusableConfigsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listReusableConfigs.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listReusableConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.security.privateca.v1beta1.ReusableConfig[] = []; + stream.on('data', (response: protos.google.cloud.security.privateca.v1beta1.ReusableConfig) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listReusableConfigs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listReusableConfigs, request)); + assert.strictEqual( + (client.descriptors.page.listReusableConfigs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listReusableConfigs without error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListReusableConfigsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ReusableConfig()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ReusableConfig()), + generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ReusableConfig()), + ]; + client.descriptors.page.listReusableConfigs.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.security.privateca.v1beta1.IReusableConfig[] = []; + const iterable = client.listReusableConfigsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listReusableConfigs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listReusableConfigs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listReusableConfigs with error', async () => { + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListReusableConfigsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listReusableConfigs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listReusableConfigsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.security.privateca.v1beta1.IReusableConfig[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listReusableConfigs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listReusableConfigs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('certificate', () => { + const fakePath = "/rendered/path/certificate"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + certificate_authority: "certificateAuthorityValue", + certificate: "certificateValue", + }; + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.certificatePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.certificatePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('certificatePath', () => { + const result = client.certificatePath("projectValue", "locationValue", "certificateAuthorityValue", "certificateValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.certificatePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromCertificateName', () => { + const result = client.matchProjectFromCertificateName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.certificatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromCertificateName', () => { + const result = client.matchLocationFromCertificateName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.certificatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCertificateAuthorityFromCertificateName', () => { + const result = client.matchCertificateAuthorityFromCertificateName(fakePath); + assert.strictEqual(result, "certificateAuthorityValue"); + assert((client.pathTemplates.certificatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCertificateFromCertificateName', () => { + const result = client.matchCertificateFromCertificateName(fakePath); + assert.strictEqual(result, "certificateValue"); + assert((client.pathTemplates.certificatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('certificateAuthority', () => { + const fakePath = "/rendered/path/certificateAuthority"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + certificate_authority: "certificateAuthorityValue", + }; + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.certificateAuthorityPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.certificateAuthorityPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('certificateAuthorityPath', () => { + const result = client.certificateAuthorityPath("projectValue", "locationValue", "certificateAuthorityValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.certificateAuthorityPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromCertificateAuthorityName', () => { + const result = client.matchProjectFromCertificateAuthorityName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.certificateAuthorityPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromCertificateAuthorityName', () => { + const result = client.matchLocationFromCertificateAuthorityName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.certificateAuthorityPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCertificateAuthorityFromCertificateAuthorityName', () => { + const result = client.matchCertificateAuthorityFromCertificateAuthorityName(fakePath); + assert.strictEqual(result, "certificateAuthorityValue"); + assert((client.pathTemplates.certificateAuthorityPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('certificateRevocationList', () => { + const fakePath = "/rendered/path/certificateRevocationList"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + certificate_authority: "certificateAuthorityValue", + certificate_revocation_list: "certificateRevocationListValue", + }; + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.certificateRevocationListPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.certificateRevocationListPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('certificateRevocationListPath', () => { + const result = client.certificateRevocationListPath("projectValue", "locationValue", "certificateAuthorityValue", "certificateRevocationListValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.certificateRevocationListPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromCertificateRevocationListName', () => { + const result = client.matchProjectFromCertificateRevocationListName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.certificateRevocationListPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromCertificateRevocationListName', () => { + const result = client.matchLocationFromCertificateRevocationListName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.certificateRevocationListPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCertificateAuthorityFromCertificateRevocationListName', () => { + const result = client.matchCertificateAuthorityFromCertificateRevocationListName(fakePath); + assert.strictEqual(result, "certificateAuthorityValue"); + assert((client.pathTemplates.certificateRevocationListPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCertificateRevocationListFromCertificateRevocationListName', () => { + const result = client.matchCertificateRevocationListFromCertificateRevocationListName(fakePath); + assert.strictEqual(result, "certificateRevocationListValue"); + assert((client.pathTemplates.certificateRevocationListPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + 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('reusableConfig', () => { + const fakePath = "/rendered/path/reusableConfig"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + reusable_config: "reusableConfigValue", + }; + const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.reusableConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.reusableConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('reusableConfigPath', () => { + const result = client.reusableConfigPath("projectValue", "locationValue", "reusableConfigValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.reusableConfigPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromReusableConfigName', () => { + const result = client.matchProjectFromReusableConfigName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.reusableConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromReusableConfigName', () => { + const result = client.matchLocationFromReusableConfigName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.reusableConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchReusableConfigFromReusableConfigName', () => { + const result = client.matchReusableConfigFromReusableConfigName(fakePath); + assert.strictEqual(result, "reusableConfigValue"); + assert((client.pathTemplates.reusableConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/v1beta1/tsconfig.json b/owl-bot-staging/v1beta1/tsconfig.json new file mode 100644 index 0000000..c78f1c8 --- /dev/null +++ b/owl-bot-staging/v1beta1/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/owl-bot-staging/v1beta1/webpack.config.js b/owl-bot-staging/v1beta1/webpack.config.js new file mode 100644 index 0000000..a187538 --- /dev/null +++ b/owl-bot-staging/v1beta1/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: 'CertificateAuthorityService', + filename: './certificate-authority-service.js', + }, + node: { + child_process: 'empty', + fs: 'empty', + crypto: 'empty', + }, + resolve: { + alias: { + '../../../package.json': path.resolve(__dirname, 'package.json'), + }, + extensions: ['.js', '.json', '.ts'], + }, + module: { + rules: [ + { + test: /\.tsx?$/, + use: 'ts-loader', + exclude: /node_modules/ + }, + { + test: /node_modules[\\/]@grpc[\\/]grpc-js/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]grpc/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]retry-request/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]https?-proxy-agent/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]gtoken/, + use: 'null-loader' + }, + ], + }, + mode: 'production', +}; From d83db70d02314ee97dead4fe241fd3934495292d Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 24 Jun 2022 10:05:28 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- owl-bot-staging/v1/.eslintignore | 7 - owl-bot-staging/v1/.eslintrc.json | 3 - owl-bot-staging/v1/.gitignore | 14 - owl-bot-staging/v1/.jsdoc.js | 55 - owl-bot-staging/v1/.mocharc.js | 33 - owl-bot-staging/v1/.prettierrc.js | 22 - owl-bot-staging/v1/README.md | 1 - owl-bot-staging/v1/linkinator.config.json | 16 - owl-bot-staging/v1/package.json | 64 - .../security/privateca/v1/resources.proto | 1123 ---- .../cloud/security/privateca/v1/service.proto | 1277 ----- ..._service.activate_certificate_authority.js | 86 - ...ficate_authority_service.create_ca_pool.js | 85 - ...te_authority_service.create_certificate.js | 105 - ...ty_service.create_certificate_authority.js | 86 - ...ity_service.create_certificate_template.js | 86 - ...ficate_authority_service.delete_ca_pool.js | 74 - ...ty_service.delete_certificate_authority.js | 85 - ...ity_service.delete_certificate_template.js | 74 - ...y_service.disable_certificate_authority.js | 74 - ...ty_service.enable_certificate_authority.js | 74 - ...ficate_authority_service.fetch_ca_certs.js | 73 - ...service.fetch_certificate_authority_csr.js | 59 - ...rtificate_authority_service.get_ca_pool.js | 58 - ...icate_authority_service.get_certificate.js | 58 - ...ority_service.get_certificate_authority.js | 59 - ...service.get_certificate_revocation_list.js | 59 - ...hority_service.get_certificate_template.js | 59 - ...ificate_authority_service.list_ca_pools.js | 84 - ...ty_service.list_certificate_authorities.js | 84 - ...rvice.list_certificate_revocation_lists.js | 84 - ...rity_service.list_certificate_templates.js | 84 - ...ate_authority_service.list_certificates.js | 88 - ...te_authority_service.revoke_certificate.js | 79 - ..._service.undelete_certificate_authority.js | 74 - ...ficate_authority_service.update_ca_pool.js | 78 - ...te_authority_service.update_certificate.js | 77 - ...ty_service.update_certificate_authority.js | 78 - ...vice.update_certificate_revocation_list.js | 78 - ...ity_service.update_certificate_template.js | 78 - ...ta.google.cloud.security.privateca.v1.json | 1407 ----- owl-bot-staging/v1/src/index.ts | 25 - .../certificate_authority_service_client.ts | 4427 -------------- ...icate_authority_service_client_config.json | 176 - ...tificate_authority_service_proto_list.json | 4 - owl-bot-staging/v1/src/v1/gapic_metadata.json | 333 -- owl-bot-staging/v1/src/v1/index.ts | 19 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - owl-bot-staging/v1/system-test/install.ts | 49 - .../gapic_certificate_authority_service_v1.ts | 5062 ----------------- owl-bot-staging/v1/tsconfig.json | 19 - owl-bot-staging/v1/webpack.config.js | 64 - owl-bot-staging/v1beta1/.eslintignore | 7 - owl-bot-staging/v1beta1/.eslintrc.json | 3 - owl-bot-staging/v1beta1/.gitignore | 14 - owl-bot-staging/v1beta1/.jsdoc.js | 55 - owl-bot-staging/v1beta1/.mocharc.js | 33 - owl-bot-staging/v1beta1/.prettierrc.js | 22 - owl-bot-staging/v1beta1/README.md | 1 - .../v1beta1/linkinator.config.json | 16 - owl-bot-staging/v1beta1/package.json | 64 - .../privateca/v1beta1/resources.proto | 903 --- .../security/privateca/v1beta1/service.proto | 871 --- ..._service.activate_certificate_authority.js | 86 - ...te_authority_service.create_certificate.js | 86 - ...ty_service.create_certificate_authority.js | 86 - ...y_service.disable_certificate_authority.js | 74 - ...ty_service.enable_certificate_authority.js | 74 - ...service.fetch_certificate_authority_csr.js | 59 - ...icate_authority_service.get_certificate.js | 58 - ...ority_service.get_certificate_authority.js | 59 - ...service.get_certificate_revocation_list.js | 59 - ...e_authority_service.get_reusable_config.js | 58 - ...ty_service.list_certificate_authorities.js | 84 - ...rvice.list_certificate_revocation_lists.js | 84 - ...ate_authority_service.list_certificates.js | 88 - ...authority_service.list_reusable_configs.js | 84 - ...y_service.restore_certificate_authority.js | 74 - ...te_authority_service.revoke_certificate.js | 78 - ...e.schedule_delete_certificate_authority.js | 74 - ...te_authority_service.update_certificate.js | 77 - ...ty_service.update_certificate_authority.js | 78 - ...vice.update_certificate_revocation_list.js | 78 - ...ogle.cloud.security.privateca.v1beta1.json | 963 ---- owl-bot-staging/v1beta1/src/index.ts | 25 - .../certificate_authority_service_client.ts | 3027 ---------- ...icate_authority_service_client_config.json | 131 - ...tificate_authority_service_proto_list.json | 4 - .../v1beta1/src/v1beta1/gapic_metadata.json | 239 - owl-bot-staging/v1beta1/src/v1beta1/index.ts | 19 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v1beta1/system-test/install.ts | 49 - ...c_certificate_authority_service_v1beta1.ts | 3271 ----------- owl-bot-staging/v1beta1/tsconfig.json | 19 - owl-bot-staging/v1beta1/webpack.config.js | 64 - .../certificate_authority_service_client.ts | 95 +- .../certificate_authority_service_client.ts | 27 +- 99 files changed, 98 insertions(+), 27860 deletions(-) delete mode 100644 owl-bot-staging/v1/.eslintignore delete mode 100644 owl-bot-staging/v1/.eslintrc.json delete mode 100644 owl-bot-staging/v1/.gitignore delete mode 100644 owl-bot-staging/v1/.jsdoc.js delete mode 100644 owl-bot-staging/v1/.mocharc.js delete mode 100644 owl-bot-staging/v1/.prettierrc.js delete mode 100644 owl-bot-staging/v1/README.md delete mode 100644 owl-bot-staging/v1/linkinator.config.json delete mode 100644 owl-bot-staging/v1/package.json delete mode 100644 owl-bot-staging/v1/protos/google/cloud/security/privateca/v1/resources.proto delete mode 100644 owl-bot-staging/v1/protos/google/cloud/security/privateca/v1/service.proto delete mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.activate_certificate_authority.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.create_ca_pool.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.create_certificate.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.create_certificate_authority.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.create_certificate_template.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.delete_ca_pool.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.delete_certificate_authority.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.delete_certificate_template.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.disable_certificate_authority.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.enable_certificate_authority.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.fetch_ca_certs.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.fetch_certificate_authority_csr.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.get_ca_pool.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.get_certificate.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.get_certificate_authority.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.get_certificate_revocation_list.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.get_certificate_template.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.list_ca_pools.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.list_certificate_authorities.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.list_certificate_revocation_lists.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.list_certificate_templates.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.list_certificates.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.revoke_certificate.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.undelete_certificate_authority.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.update_ca_pool.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.update_certificate.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.update_certificate_authority.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.update_certificate_revocation_list.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.update_certificate_template.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.security.privateca.v1.json delete mode 100644 owl-bot-staging/v1/src/index.ts delete mode 100644 owl-bot-staging/v1/src/v1/certificate_authority_service_client.ts delete mode 100644 owl-bot-staging/v1/src/v1/certificate_authority_service_client_config.json delete mode 100644 owl-bot-staging/v1/src/v1/certificate_authority_service_proto_list.json delete mode 100644 owl-bot-staging/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/v1/system-test/install.ts delete mode 100644 owl-bot-staging/v1/test/gapic_certificate_authority_service_v1.ts delete mode 100644 owl-bot-staging/v1/tsconfig.json delete mode 100644 owl-bot-staging/v1/webpack.config.js delete mode 100644 owl-bot-staging/v1beta1/.eslintignore delete mode 100644 owl-bot-staging/v1beta1/.eslintrc.json delete mode 100644 owl-bot-staging/v1beta1/.gitignore delete mode 100644 owl-bot-staging/v1beta1/.jsdoc.js delete mode 100644 owl-bot-staging/v1beta1/.mocharc.js delete mode 100644 owl-bot-staging/v1beta1/.prettierrc.js delete mode 100644 owl-bot-staging/v1beta1/README.md delete mode 100644 owl-bot-staging/v1beta1/linkinator.config.json delete mode 100644 owl-bot-staging/v1beta1/package.json delete mode 100644 owl-bot-staging/v1beta1/protos/google/cloud/security/privateca/v1beta1/resources.proto delete mode 100644 owl-bot-staging/v1beta1/protos/google/cloud/security/privateca/v1beta1/service.proto delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.activate_certificate_authority.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.create_certificate.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.create_certificate_authority.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.disable_certificate_authority.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.enable_certificate_authority.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.fetch_certificate_authority_csr.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.get_certificate.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.get_certificate_authority.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.get_certificate_revocation_list.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.get_reusable_config.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.list_certificate_authorities.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.list_certificate_revocation_lists.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.list_certificates.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.list_reusable_configs.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.restore_certificate_authority.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.revoke_certificate.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.schedule_delete_certificate_authority.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.update_certificate.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.update_certificate_authority.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.update_certificate_revocation_list.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.security.privateca.v1beta1.json delete mode 100644 owl-bot-staging/v1beta1/src/index.ts delete mode 100644 owl-bot-staging/v1beta1/src/v1beta1/certificate_authority_service_client.ts delete mode 100644 owl-bot-staging/v1beta1/src/v1beta1/certificate_authority_service_client_config.json delete mode 100644 owl-bot-staging/v1beta1/src/v1beta1/certificate_authority_service_proto_list.json delete mode 100644 owl-bot-staging/v1beta1/src/v1beta1/gapic_metadata.json delete mode 100644 owl-bot-staging/v1beta1/src/v1beta1/index.ts delete mode 100644 owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/v1beta1/system-test/install.ts delete mode 100644 owl-bot-staging/v1beta1/test/gapic_certificate_authority_service_v1beta1.ts delete mode 100644 owl-bot-staging/v1beta1/tsconfig.json delete mode 100644 owl-bot-staging/v1beta1/webpack.config.js diff --git a/owl-bot-staging/v1/.eslintignore b/owl-bot-staging/v1/.eslintignore deleted file mode 100644 index cfc348e..0000000 --- a/owl-bot-staging/v1/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/owl-bot-staging/v1/.eslintrc.json b/owl-bot-staging/v1/.eslintrc.json deleted file mode 100644 index 7821534..0000000 --- a/owl-bot-staging/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/v1/.gitignore b/owl-bot-staging/v1/.gitignore deleted file mode 100644 index 5d32b23..0000000 --- a/owl-bot-staging/v1/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -**/*.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/owl-bot-staging/v1/.jsdoc.js b/owl-bot-staging/v1/.jsdoc.js deleted file mode 100644 index 8ee4107..0000000 --- a/owl-bot-staging/v1/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// 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/security-private-ca', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/v1/.mocharc.js b/owl-bot-staging/v1/.mocharc.js deleted file mode 100644 index 481c522..0000000 --- a/owl-bot-staging/v1/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// 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. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/owl-bot-staging/v1/.prettierrc.js b/owl-bot-staging/v1/.prettierrc.js deleted file mode 100644 index 494e147..0000000 --- a/owl-bot-staging/v1/.prettierrc.js +++ /dev/null @@ -1,22 +0,0 @@ -// 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. ** - - -module.exports = { - ...require('gts/.prettierrc.json') -} diff --git a/owl-bot-staging/v1/README.md b/owl-bot-staging/v1/README.md deleted file mode 100644 index c74f8ea..0000000 --- a/owl-bot-staging/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Privateca: Nodejs Client diff --git a/owl-bot-staging/v1/linkinator.config.json b/owl-bot-staging/v1/linkinator.config.json deleted file mode 100644 index befd23c..0000000 --- a/owl-bot-staging/v1/linkinator.config.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "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/owl-bot-staging/v1/package.json b/owl-bot-staging/v1/package.json deleted file mode 100644 index 541fa74..0000000 --- a/owl-bot-staging/v1/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "@google-cloud/security-private-ca", - "version": "0.1.0", - "description": "Privateca client for Node.js", - "repository": "googleapis/nodejs-privateca", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "build/src/index.js", - "files": [ - "build/src", - "build/protos" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google privateca", - "privateca", - "certificate authority service" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^3.1.1" - }, - "devDependencies": { - "@types/mocha": "^9.1.0", - "@types/node": "^16.0.0", - "@types/sinon": "^10.0.8", - "c8": "^7.11.0", - "gts": "^3.1.0", - "jsdoc": "^3.6.7", - "jsdoc-fresh": "^1.1.1", - "jsdoc-region-tag": "^1.3.1", - "linkinator": "^3.0.0", - "mocha": "^9.1.4", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^13.0.0", - "ts-loader": "^9.2.6", - "typescript": "^4.5.5", - "webpack": "^5.67.0", - "webpack-cli": "^4.9.1" - }, - "engines": { - "node": ">=v12" - } -} diff --git a/owl-bot-staging/v1/protos/google/cloud/security/privateca/v1/resources.proto b/owl-bot-staging/v1/protos/google/cloud/security/privateca/v1/resources.proto deleted file mode 100644 index 3f6dfb1..0000000 --- a/owl-bot-staging/v1/protos/google/cloud/security/privateca/v1/resources.proto +++ /dev/null @@ -1,1123 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.security.privateca.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/timestamp.proto"; -import "google/type/expr.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Security.PrivateCA.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/security/privateca/v1;privateca"; -option java_multiple_files = true; -option java_outer_classname = "PrivateCaResourcesProto"; -option java_package = "com.google.cloud.security.privateca.v1"; -option php_namespace = "Google\\Cloud\\Security\\PrivateCA\\V1"; -option ruby_package = "Google::Cloud::Security::PrivateCA::V1"; - -// A [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] represents an individual Certificate Authority. -// A [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] can be used to create [Certificates][google.cloud.security.privateca.v1.Certificate]. -message CertificateAuthority { - option (google.api.resource) = { - type: "privateca.googleapis.com/CertificateAuthority" - pattern: "projects/{project}/locations/{location}/caPools/{ca_pool}/certificateAuthorities/{certificate_authority}" - }; - - // The type of a [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority], indicating its issuing chain. - enum Type { - // Not specified. - TYPE_UNSPECIFIED = 0; - - // Self-signed CA. - SELF_SIGNED = 1; - - // Subordinate CA. Could be issued by a Private CA [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - // or an unmanaged CA. - SUBORDINATE = 2; - } - - // The state of a [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority], indicating if it can be used. - enum State { - // Not specified. - STATE_UNSPECIFIED = 0; - - // Certificates can be issued from this CA. CRLs will be generated for this - // CA. The CA will be part of the [CaPool][google.cloud.security.privateca.v1.CaPool]'s trust anchor, and will be - // used to issue certificates from the [CaPool][google.cloud.security.privateca.v1.CaPool]. - ENABLED = 1; - - // Certificates cannot be issued from this CA. CRLs will still be generated. - // The CA will be part of the [CaPool][google.cloud.security.privateca.v1.CaPool]'s trust anchor, but will not be - // used to issue certificates from the [CaPool][google.cloud.security.privateca.v1.CaPool]. - DISABLED = 2; - - // Certificates can be issued from this CA. CRLs will be generated for this - // CA. The CA will be part of the [CaPool][google.cloud.security.privateca.v1.CaPool]'s trust anchor, but will not - // be used to issue certificates from the [CaPool][google.cloud.security.privateca.v1.CaPool]. - STAGED = 3; - - // Certificates cannot be issued from this CA. CRLs will not be generated. - // The CA will not be part of the [CaPool][google.cloud.security.privateca.v1.CaPool]'s trust anchor, and will not be - // used to issue certificates from the [CaPool][google.cloud.security.privateca.v1.CaPool]. - AWAITING_USER_ACTIVATION = 4; - - // Certificates cannot be issued from this CA. CRLs will not be generated. - // The CA may still be recovered by calling - // [CertificateAuthorityService.UndeleteCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.UndeleteCertificateAuthority] before - // [expire_time][google.cloud.security.privateca.v1.CertificateAuthority.expire_time]. - // The CA will not be part of the [CaPool][google.cloud.security.privateca.v1.CaPool]'s trust anchor, and will not be - // used to issue certificates from the [CaPool][google.cloud.security.privateca.v1.CaPool]. - DELETED = 5; - } - - // URLs where a [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] will publish content. - message AccessUrls { - // The URL where this [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]'s CA certificate is - // published. This will only be set for CAs that have been activated. - string ca_certificate_access_url = 1; - - // The URLs where this [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]'s CRLs are published. This - // will only be set for CAs that have been activated. - repeated string crl_access_urls = 2; - } - - // A Cloud KMS key configuration that a [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] will use. - message KeyVersionSpec { - oneof KeyVersion { - // The resource name for an existing Cloud KMS CryptoKeyVersion in the - // format - // `projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*`. - // This option enables full flexibility in the key's capabilities and - // properties. - string cloud_kms_key_version = 1; - - // The algorithm to use for creating a managed Cloud KMS key for a for a - // simplified experience. All managed keys will be have their - // [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] as `HSM`. - SignHashAlgorithm algorithm = 2; - } - } - - // The algorithm of a Cloud KMS CryptoKeyVersion of a - // [CryptoKey][google.cloud.kms.v1.CryptoKey] with the - // [CryptoKeyPurpose][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose] value - // `ASYMMETRIC_SIGN`. These values correspond to the - // [CryptoKeyVersionAlgorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm] - // values. For RSA signing algorithms, the PSS algorithms should be preferred, - // use PKCS1 algorithms if required for compatibility. For further - // recommendations, see - // https://cloud.google.com/kms/docs/algorithms#algorithm_recommendations. - enum SignHashAlgorithm { - // Not specified. - SIGN_HASH_ALGORITHM_UNSPECIFIED = 0; - - // maps to CryptoKeyVersionAlgorithm.RSA_SIGN_PSS_2048_SHA256 - RSA_PSS_2048_SHA256 = 1; - - // maps to CryptoKeyVersionAlgorithm. RSA_SIGN_PSS_3072_SHA256 - RSA_PSS_3072_SHA256 = 2; - - // maps to CryptoKeyVersionAlgorithm.RSA_SIGN_PSS_4096_SHA256 - RSA_PSS_4096_SHA256 = 3; - - // maps to CryptoKeyVersionAlgorithm.RSA_SIGN_PKCS1_2048_SHA256 - RSA_PKCS1_2048_SHA256 = 6; - - // maps to CryptoKeyVersionAlgorithm.RSA_SIGN_PKCS1_3072_SHA256 - RSA_PKCS1_3072_SHA256 = 7; - - // maps to CryptoKeyVersionAlgorithm.RSA_SIGN_PKCS1_4096_SHA256 - RSA_PKCS1_4096_SHA256 = 8; - - // maps to CryptoKeyVersionAlgorithm.EC_SIGN_P256_SHA256 - EC_P256_SHA256 = 4; - - // maps to CryptoKeyVersionAlgorithm.EC_SIGN_P384_SHA384 - EC_P384_SHA384 = 5; - } - - // Output only. The resource name for this [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] in the - // format `projects/*/locations/*/caPools/*/certificateAuthorities/*`. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Required. Immutable. The [Type][google.cloud.security.privateca.v1.CertificateAuthority.Type] of this [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. - Type type = 2 [ - (google.api.field_behavior) = REQUIRED, - (google.api.field_behavior) = IMMUTABLE - ]; - - // Required. Immutable. The config used to create a self-signed X.509 certificate or CSR. - CertificateConfig config = 3 [ - (google.api.field_behavior) = REQUIRED, - (google.api.field_behavior) = IMMUTABLE - ]; - - // Required. Immutable. The desired lifetime of the CA certificate. Used to create the - // "not_before_time" and "not_after_time" fields inside an X.509 - // certificate. - google.protobuf.Duration lifetime = 4 [ - (google.api.field_behavior) = REQUIRED, - (google.api.field_behavior) = IMMUTABLE - ]; - - // Required. Immutable. Used when issuing certificates for this [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. If this - // [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] is a self-signed CertificateAuthority, this key - // is also used to sign the self-signed CA certificate. Otherwise, it - // is used to sign a CSR. - KeyVersionSpec key_spec = 5 [ - (google.api.field_behavior) = REQUIRED, - (google.api.field_behavior) = IMMUTABLE - ]; - - // Optional. If this is a subordinate [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority], this field will be set - // with the subordinate configuration, which describes its issuers. This may - // be updated, but this [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] must continue to validate. - SubordinateConfig subordinate_config = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The [CaPool.Tier][google.cloud.security.privateca.v1.CaPool.Tier] of the [CaPool][google.cloud.security.privateca.v1.CaPool] that includes this - // [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. - CaPool.Tier tier = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The [State][google.cloud.security.privateca.v1.CertificateAuthority.State] for this [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. - State state = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. This [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]'s certificate chain, including the current - // [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]'s certificate. Ordered such that the root issuer - // is the final element (consistent with RFC 5246). For a self-signed CA, this - // will only list the current [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]'s certificate. - repeated string pem_ca_certificates = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A structured description of this [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]'s CA certificate - // and its issuers. Ordered as self-to-root. - repeated CertificateDescription ca_certificate_descriptions = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Immutable. The name of a Cloud Storage bucket where this [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] will - // publish content, such as the CA certificate and CRLs. This must be a bucket - // name, without any prefixes (such as `gs://`) or suffixes (such as - // `.googleapis.com`). For example, to use a bucket named `my-bucket`, you - // would simply specify `my-bucket`. If not specified, a managed bucket will - // be created. - string gcs_bucket = 11 [(google.api.field_behavior) = IMMUTABLE]; - - // Output only. URLs for accessing content published by this CA, such as the CA certificate - // and CRLs. - AccessUrls access_urls = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time at which this [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] was created. - google.protobuf.Timestamp create_time = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time at which this [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] was last updated. - google.protobuf.Timestamp update_time = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time at which this [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] was soft deleted, if - // it is in the [DELETED][google.cloud.security.privateca.v1.CertificateAuthority.State.DELETED] state. - google.protobuf.Timestamp delete_time = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time at which this [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] will be permanently purged, - // if it is in the [DELETED][google.cloud.security.privateca.v1.CertificateAuthority.State.DELETED] state. - google.protobuf.Timestamp expire_time = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Labels with user-defined metadata. - map labels = 17 [(google.api.field_behavior) = OPTIONAL]; -} - -// A [CaPool][google.cloud.security.privateca.v1.CaPool] represents a group of -// [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority] that form a trust anchor. A -// [CaPool][google.cloud.security.privateca.v1.CaPool] can be used to manage issuance policies for one or more -// [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] resources and to rotate CA certificates in and out -// of the trust anchor. -message CaPool { - option (google.api.resource) = { - type: "privateca.googleapis.com/CaPool" - pattern: "projects/{project}/locations/{location}/caPools/{ca_pool}" - }; - - // The tier of a [CaPool][google.cloud.security.privateca.v1.CaPool], indicating its supported functionality and/or - // billing SKU. - enum Tier { - // Not specified. - TIER_UNSPECIFIED = 0; - - // Enterprise tier. - ENTERPRISE = 1; - - // DevOps tier. - DEVOPS = 2; - } - - // Options relating to the publication of each [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]'s CA - // certificate and CRLs and their inclusion as extensions in issued - // [Certificates][google.cloud.security.privateca.v1.Certificate]. The options set here apply to certificates - // issued by any [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] in the [CaPool][google.cloud.security.privateca.v1.CaPool]. - message PublishingOptions { - // Optional. When true, publishes each [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]'s CA certificate and - // includes its URL in the "Authority Information Access" X.509 extension - // in all issued [Certificates][google.cloud.security.privateca.v1.Certificate]. If this is false, the CA - // certificate will not be published and the corresponding X.509 extension - // will not be written in issued certificates. - bool publish_ca_cert = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. When true, publishes each [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]'s CRL and includes its - // URL in the "CRL Distribution Points" X.509 extension in all issued - // [Certificates][google.cloud.security.privateca.v1.Certificate]. If this is false, CRLs will not be published - // and the corresponding X.509 extension will not be written in issued - // certificates. - // CRLs will expire 7 days from their creation. However, we will rebuild - // daily. CRLs are also rebuilt shortly after a certificate is revoked. - bool publish_crl = 2 [(google.api.field_behavior) = OPTIONAL]; - } - - // Defines controls over all certificate issuance within a [CaPool][google.cloud.security.privateca.v1.CaPool]. - message IssuancePolicy { - // Describes a "type" of key that may be used in a [Certificate][google.cloud.security.privateca.v1.Certificate] issued - // from a [CaPool][google.cloud.security.privateca.v1.CaPool]. - // Note that a single [AllowedKeyType][google.cloud.security.privateca.v1.CaPool.IssuancePolicy.AllowedKeyType] may refer to either a - // fully-qualified key algorithm, such as RSA 4096, or a family of key - // algorithms, such as any RSA key. - message AllowedKeyType { - // Describes an RSA key that may be used in a [Certificate][google.cloud.security.privateca.v1.Certificate] issued from - // a [CaPool][google.cloud.security.privateca.v1.CaPool]. - message RsaKeyType { - // Optional. The minimum allowed RSA modulus size (inclusive), in bits. If this is - // not set, or if set to zero, the service-level min RSA modulus size - // will continue to apply. - int64 min_modulus_size = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The maximum allowed RSA modulus size (inclusive), in bits. If this is - // not set, or if set to zero, the service will not enforce an explicit - // upper bound on RSA modulus sizes. - int64 max_modulus_size = 2 [(google.api.field_behavior) = OPTIONAL]; - } - - // Describes an Elliptic Curve key that may be used in a [Certificate][google.cloud.security.privateca.v1.Certificate] - // issued from a [CaPool][google.cloud.security.privateca.v1.CaPool]. - message EcKeyType { - // Describes an elliptic curve-based signature algorithm that may be - // used in a [Certificate][google.cloud.security.privateca.v1.Certificate] issued from a [CaPool][google.cloud.security.privateca.v1.CaPool]. - enum EcSignatureAlgorithm { - // Not specified. Signifies that any signature algorithm may be used. - EC_SIGNATURE_ALGORITHM_UNSPECIFIED = 0; - - // Refers to the Elliptic Curve Digital Signature Algorithm over the - // NIST P-256 curve. - ECDSA_P256 = 1; - - // Refers to the Elliptic Curve Digital Signature Algorithm over the - // NIST P-384 curve. - ECDSA_P384 = 2; - - // Refers to the Edwards-curve Digital Signature Algorithm over curve - // 25519, as described in RFC 8410. - EDDSA_25519 = 3; - } - - // Optional. A signature algorithm that must be used. If this is omitted, any - // EC-based signature algorithm will be allowed. - EcSignatureAlgorithm signature_algorithm = 1 [(google.api.field_behavior) = OPTIONAL]; - } - - oneof key_type { - // Represents an allowed RSA key type. - RsaKeyType rsa = 1; - - // Represents an allowed Elliptic Curve key type. - EcKeyType elliptic_curve = 2; - } - } - - // [IssuanceModes][google.cloud.security.privateca.v1.CaPool.IssuancePolicy.IssuanceModes] specifies the allowed ways in which - // [Certificates][google.cloud.security.privateca.v1.Certificate] may be requested from this - // [CaPool][google.cloud.security.privateca.v1.CaPool]. - message IssuanceModes { - // Optional. When true, allows callers to create [Certificates][google.cloud.security.privateca.v1.Certificate] by - // specifying a CSR. - bool allow_csr_based_issuance = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. When true, allows callers to create [Certificates][google.cloud.security.privateca.v1.Certificate] by - // specifying a [CertificateConfig][google.cloud.security.privateca.v1.CertificateConfig]. - bool allow_config_based_issuance = 2 [(google.api.field_behavior) = OPTIONAL]; - } - - // Optional. If any [AllowedKeyType][google.cloud.security.privateca.v1.CaPool.IssuancePolicy.AllowedKeyType] is specified, then the certificate request's - // public key must match one of the key types listed here. Otherwise, - // any key may be used. - repeated AllowedKeyType allowed_key_types = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The maximum lifetime allowed for issued [Certificates][google.cloud.security.privateca.v1.Certificate]. Note - // that if the issuing [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] expires before a - // [Certificate][google.cloud.security.privateca.v1.Certificate]'s requested maximum_lifetime, the effective lifetime will - // be explicitly truncated to match it. - google.protobuf.Duration maximum_lifetime = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If specified, then only methods allowed in the [IssuanceModes][google.cloud.security.privateca.v1.CaPool.IssuancePolicy.IssuanceModes] may be - // used to issue [Certificates][google.cloud.security.privateca.v1.Certificate]. - IssuanceModes allowed_issuance_modes = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A set of X.509 values that will be applied to all certificates issued - // through this [CaPool][google.cloud.security.privateca.v1.CaPool]. If a certificate request includes conflicting - // values for the same properties, they will be overwritten by the values - // defined here. If a certificate request uses a [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] - // that defines conflicting - // [predefined_values][google.cloud.security.privateca.v1.CertificateTemplate.predefined_values] for the same - // properties, the certificate issuance request will fail. - X509Parameters baseline_values = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Describes constraints on identities that may appear in - // [Certificates][google.cloud.security.privateca.v1.Certificate] issued through this [CaPool][google.cloud.security.privateca.v1.CaPool]. - // If this is omitted, then this [CaPool][google.cloud.security.privateca.v1.CaPool] will not add restrictions on a - // certificate's identity. - CertificateIdentityConstraints identity_constraints = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Describes the set of X.509 extensions that may appear in a - // [Certificate][google.cloud.security.privateca.v1.Certificate] issued through this [CaPool][google.cloud.security.privateca.v1.CaPool]. If a certificate request - // sets extensions that don't appear in the [passthrough_extensions][google.cloud.security.privateca.v1.CaPool.IssuancePolicy.passthrough_extensions], - // those extensions will be dropped. If a certificate request uses a - // [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] with - // [predefined_values][google.cloud.security.privateca.v1.CertificateTemplate.predefined_values] that don't - // appear here, the certificate issuance request will fail. If this is - // omitted, then this [CaPool][google.cloud.security.privateca.v1.CaPool] will not add restrictions on a - // certificate's X.509 extensions. These constraints do not apply to X.509 - // extensions set in this [CaPool][google.cloud.security.privateca.v1.CaPool]'s [baseline_values][google.cloud.security.privateca.v1.CaPool.IssuancePolicy.baseline_values]. - CertificateExtensionConstraints passthrough_extensions = 6 [(google.api.field_behavior) = OPTIONAL]; - } - - // Output only. The resource name for this [CaPool][google.cloud.security.privateca.v1.CaPool] in the - // format `projects/*/locations/*/caPools/*`. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Required. Immutable. The [Tier][google.cloud.security.privateca.v1.CaPool.Tier] of this [CaPool][google.cloud.security.privateca.v1.CaPool]. - Tier tier = 2 [ - (google.api.field_behavior) = REQUIRED, - (google.api.field_behavior) = IMMUTABLE - ]; - - // Optional. The [IssuancePolicy][google.cloud.security.privateca.v1.CaPool.IssuancePolicy] to control how [Certificates][google.cloud.security.privateca.v1.Certificate] - // will be issued from this [CaPool][google.cloud.security.privateca.v1.CaPool]. - IssuancePolicy issuance_policy = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The [PublishingOptions][google.cloud.security.privateca.v1.CaPool.PublishingOptions] to follow when issuing - // [Certificates][google.cloud.security.privateca.v1.Certificate] from any [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] in this - // [CaPool][google.cloud.security.privateca.v1.CaPool]. - PublishingOptions publishing_options = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Labels with user-defined metadata. - map labels = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// A [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList] corresponds to a signed X.509 certificate -// Revocation List (CRL). A CRL contains the serial numbers of certificates that -// should no longer be trusted. -message CertificateRevocationList { - option (google.api.resource) = { - type: "privateca.googleapis.com/CertificateRevocationList" - pattern: "projects/{project}/locations/{location}/caPools/{ca_pool}/certificateAuthorities/{certificate_authority}/certificateRevocationLists/{certificate_revocation_list}" - }; - - // Describes a revoked [Certificate][google.cloud.security.privateca.v1.Certificate]. - message RevokedCertificate { - // The resource name for the [Certificate][google.cloud.security.privateca.v1.Certificate] in the format - // `projects/*/locations/*/caPools/*/certificates/*`. - string certificate = 1 [(google.api.resource_reference) = { - type: "privateca.googleapis.com/Certificate" - }]; - - // The serial number of the [Certificate][google.cloud.security.privateca.v1.Certificate]. - string hex_serial_number = 2; - - // The reason the [Certificate][google.cloud.security.privateca.v1.Certificate] was revoked. - RevocationReason revocation_reason = 3; - } - - // The state of a [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList], indicating if it is current. - enum State { - // Not specified. - STATE_UNSPECIFIED = 0; - - // The [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList] is up to date. - ACTIVE = 1; - - // The [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList] is no longer current. - SUPERSEDED = 2; - } - - // Output only. The resource name for this [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList] in - // the format - // `projects/*/locations/*/caPools/*certificateAuthorities/*/ - // certificateRevocationLists/*`. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The CRL sequence number that appears in pem_crl. - int64 sequence_number = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The revoked serial numbers that appear in pem_crl. - repeated RevokedCertificate revoked_certificates = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The PEM-encoded X.509 CRL. - string pem_crl = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The location where 'pem_crl' can be accessed. - string access_url = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The [State][google.cloud.security.privateca.v1.CertificateRevocationList.State] for this [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList]. - State state = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time at which this [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList] was created. - google.protobuf.Timestamp create_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time at which this [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList] was updated. - google.protobuf.Timestamp update_time = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The revision ID of this [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList]. A new revision is - // committed whenever a new CRL is published. The format is an 8-character - // hexadecimal string. - string revision_id = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Labels with user-defined metadata. - map labels = 10 [(google.api.field_behavior) = OPTIONAL]; -} - -// A [Certificate][google.cloud.security.privateca.v1.Certificate] corresponds to a signed X.509 certificate issued by a -// [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. -message Certificate { - option (google.api.resource) = { - type: "privateca.googleapis.com/Certificate" - pattern: "projects/{project}/locations/{location}/caPools/{ca_pool}/certificates/{certificate}" - }; - - // Describes fields that are relavent to the revocation of a [Certificate][google.cloud.security.privateca.v1.Certificate]. - message RevocationDetails { - // Indicates why a [Certificate][google.cloud.security.privateca.v1.Certificate] was revoked. - RevocationReason revocation_state = 1; - - // The time at which this [Certificate][google.cloud.security.privateca.v1.Certificate] was revoked. - google.protobuf.Timestamp revocation_time = 2; - } - - // Output only. The resource name for this [Certificate][google.cloud.security.privateca.v1.Certificate] in the format - // `projects/*/locations/*/caPools/*/certificates/*`. - string name = 1 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.resource_reference) = { - type: "privateca.googleapis.com/Certificate" - } - ]; - - // The config used to create a signed X.509 certificate. - oneof certificate_config { - // Immutable. A pem-encoded X.509 certificate signing request (CSR). - string pem_csr = 2 [(google.api.field_behavior) = IMMUTABLE]; - - // Immutable. A description of the certificate and key that does not require X.509 or - // ASN.1. - CertificateConfig config = 3 [(google.api.field_behavior) = IMMUTABLE]; - } - - // Output only. The resource name of the issuing [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] in the format - // `projects/*/locations/*/caPools/*/certificateAuthorities/*`. - string issuer_certificate_authority = 4 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.resource_reference) = { - type: "privateca.googleapis.com/CertificateAuthority" - } - ]; - - // Required. Immutable. The desired lifetime of a certificate. Used to create the - // "not_before_time" and "not_after_time" fields inside an X.509 - // certificate. Note that the lifetime may be truncated if it would extend - // past the life of any certificate authority in the issuing chain. - google.protobuf.Duration lifetime = 5 [ - (google.api.field_behavior) = REQUIRED, - (google.api.field_behavior) = IMMUTABLE - ]; - - // Immutable. The resource name for a [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] used to issue this - // certificate, in the format - // `projects/*/locations/*/certificateTemplates/*`. - // If this is specified, the caller must have the necessary permission to - // use this template. If this is omitted, no template will be used. - // This template must be in the same location as the [Certificate][google.cloud.security.privateca.v1.Certificate]. - string certificate_template = 6 [ - (google.api.field_behavior) = IMMUTABLE, - (google.api.resource_reference) = { - type: "privateca.googleapis.com/CertificateTemplate" - } - ]; - - // Immutable. Specifies how the [Certificate][google.cloud.security.privateca.v1.Certificate]'s identity fields are to be decided. - // If this is omitted, the `DEFAULT` subject mode will be used. - SubjectRequestMode subject_mode = 7 [(google.api.field_behavior) = IMMUTABLE]; - - // Output only. Details regarding the revocation of this [Certificate][google.cloud.security.privateca.v1.Certificate]. This - // [Certificate][google.cloud.security.privateca.v1.Certificate] is considered revoked if and only if this field is present. - RevocationDetails revocation_details = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The pem-encoded, signed X.509 certificate. - string pem_certificate = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A structured description of the issued X.509 certificate. - CertificateDescription certificate_description = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The chain that may be used to verify the X.509 certificate. Expected to be - // in issuer-to-root order according to RFC 5246. - repeated string pem_certificate_chain = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time at which this [Certificate][google.cloud.security.privateca.v1.Certificate] was created. - google.protobuf.Timestamp create_time = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time at which this [Certificate][google.cloud.security.privateca.v1.Certificate] was updated. - google.protobuf.Timestamp update_time = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Labels with user-defined metadata. - map labels = 14 [(google.api.field_behavior) = OPTIONAL]; -} - -// A [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] refers to a managed template for certificate -// issuance. -message CertificateTemplate { - option (google.api.resource) = { - type: "privateca.googleapis.com/CertificateTemplate" - pattern: "projects/{project}/locations/{location}/certificateTemplates/{certificate_template}" - }; - - // Output only. The resource name for this [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] in the format - // `projects/*/locations/*/certificateTemplates/*`. - string name = 1 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.resource_reference) = { - type: "privateca.googleapis.com/CertificateTemplate" - } - ]; - - // Optional. A set of X.509 values that will be applied to all issued certificates that - // use this template. If the certificate request includes conflicting values - // for the same properties, they will be overwritten by the values defined - // here. If the issuing [CaPool][google.cloud.security.privateca.v1.CaPool]'s [IssuancePolicy][google.cloud.security.privateca.v1.CaPool.IssuancePolicy] - // defines conflicting - // [baseline_values][google.cloud.security.privateca.v1.CaPool.IssuancePolicy.baseline_values] for the same - // properties, the certificate issuance request will fail. - X509Parameters predefined_values = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Describes constraints on identities that may be appear in - // [Certificates][google.cloud.security.privateca.v1.Certificate] issued using this template. If this is omitted, - // then this template will not add restrictions on a certificate's identity. - CertificateIdentityConstraints identity_constraints = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Describes the set of X.509 extensions that may appear in a - // [Certificate][google.cloud.security.privateca.v1.Certificate] issued using this [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate]. If a certificate - // request sets extensions that don't appear in the - // [passthrough_extensions][google.cloud.security.privateca.v1.CertificateTemplate.passthrough_extensions], those extensions will be dropped. If the - // issuing [CaPool][google.cloud.security.privateca.v1.CaPool]'s [IssuancePolicy][google.cloud.security.privateca.v1.CaPool.IssuancePolicy] defines - // [baseline_values][google.cloud.security.privateca.v1.CaPool.IssuancePolicy.baseline_values] that don't appear - // here, the certificate issuance request will fail. If this is omitted, then - // this template will not add restrictions on a certificate's X.509 - // extensions. These constraints do not apply to X.509 extensions set in this - // [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate]'s [predefined_values][google.cloud.security.privateca.v1.CertificateTemplate.predefined_values]. - CertificateExtensionConstraints passthrough_extensions = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A human-readable description of scenarios this template is intended for. - string description = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The time at which this [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] was created. - google.protobuf.Timestamp create_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time at which this [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] was updated. - google.protobuf.Timestamp update_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Labels with user-defined metadata. - map labels = 8 [(google.api.field_behavior) = OPTIONAL]; -} - -// An [X509Parameters][google.cloud.security.privateca.v1.X509Parameters] is used to describe certain fields of an -// X.509 certificate, such as the key usage fields, fields specific to CA -// certificates, certificate policy extensions and custom extensions. -message X509Parameters { - // Describes values that are relevant in a CA certificate. - message CaOptions { - // Optional. Refers to the "CA" X.509 extension, which is a boolean value. When this - // value is missing, the extension will be omitted from the CA certificate. - optional bool is_ca = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Refers to the path length restriction X.509 extension. For a CA - // certificate, this value describes the depth of subordinate CA - // certificates that are allowed. - // If this value is less than 0, the request will fail. - // If this value is missing, the max path length will be omitted from the - // CA certificate. - optional int32 max_issuer_path_length = 2 [(google.api.field_behavior) = OPTIONAL]; - } - - // Optional. Indicates the intended use for keys that correspond to a certificate. - KeyUsage key_usage = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Describes options in this [X509Parameters][google.cloud.security.privateca.v1.X509Parameters] that are relevant in a CA - // certificate. - CaOptions ca_options = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Describes the X.509 certificate policy object identifiers, per - // https://tools.ietf.org/html/rfc5280#section-4.2.1.4. - repeated ObjectId policy_ids = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Describes Online Certificate Status Protocol (OCSP) endpoint addresses - // that appear in the "Authority Information Access" extension in the - // certificate. - repeated string aia_ocsp_servers = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Describes custom X.509 extensions. - repeated X509Extension additional_extensions = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Describes a subordinate CA's issuers. This is either a resource name to a -// known issuing [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority], or a PEM issuer certificate chain. -message SubordinateConfig { - // This message describes a subordinate CA's issuer certificate chain. This - // wrapper exists for compatibility reasons. - message SubordinateConfigChain { - // Required. Expected to be in leaf-to-root order according to RFC 5246. - repeated string pem_certificates = 1 [(google.api.field_behavior) = REQUIRED]; - } - - oneof subordinate_config { - // Required. This can refer to a [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] that was used to create a - // subordinate [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. This field is used for information - // and usability purposes only. The resource name is in the format - // `projects/*/locations/*/caPools/*/certificateAuthorities/*`. - string certificate_authority = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "privateca.googleapis.com/CertificateAuthority" - } - ]; - - // Required. Contains the PEM certificate chain for the issuers of this - // [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority], but not pem certificate for this CA itself. - SubordinateConfigChain pem_issuer_chain = 2 [(google.api.field_behavior) = REQUIRED]; - } -} - -// A [PublicKey][google.cloud.security.privateca.v1.PublicKey] describes a public key. -message PublicKey { - // Types of public keys formats that are supported. Currently, only `PEM` - // format is supported. - enum KeyFormat { - // Default unspecified value. - KEY_FORMAT_UNSPECIFIED = 0; - - // The key is PEM-encoded as defined in [RFC - // 7468](https://tools.ietf.org/html/rfc7468). It can be any of the - // following: a PEM-encoded PKCS#1/RFC 3447 RSAPublicKey - // structure, an RFC 5280 - // [SubjectPublicKeyInfo](https://tools.ietf.org/html/rfc5280#section-4.1) - // or a PEM-encoded X.509 certificate signing request (CSR). If a - // [SubjectPublicKeyInfo](https://tools.ietf.org/html/rfc5280#section-4.1) - // is specified, it can contain a A PEM-encoded PKCS#1/RFC 3447 RSAPublicKey - // or a NIST P-256/secp256r1/prime256v1 or P-384 key. If a CSR is specified, - // it will used solely for the purpose of extracting the public key. When - // generated by the service, it will always be an RFC 5280 - // [SubjectPublicKeyInfo](https://tools.ietf.org/html/rfc5280#section-4.1) - // structure containing an algorithm identifier and a key. - PEM = 1; - } - - // Required. A public key. The padding and encoding - // must match with the `KeyFormat` value specified for the `format` field. - bytes key = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The format of the public key. - KeyFormat format = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// A [CertificateConfig][google.cloud.security.privateca.v1.CertificateConfig] describes an X.509 certificate or CSR that is to be -// created, as an alternative to using ASN.1. -message CertificateConfig { - // These values are used to create the distinguished name and subject - // alternative name fields in an X.509 certificate. - message SubjectConfig { - // Required. Contains distinguished name fields such as the common name, location and - // organization. - Subject subject = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The subject alternative name fields. - SubjectAltNames subject_alt_name = 2 [(google.api.field_behavior) = OPTIONAL]; - } - - // Required. Specifies some of the values in a certificate that are related to the - // subject. - SubjectConfig subject_config = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Describes how some of the technical X.509 fields in a certificate should be - // populated. - X509Parameters x509_config = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The public key that corresponds to this config. This is, for example, used - // when issuing [Certificates][google.cloud.security.privateca.v1.Certificate], but not when creating a - // self-signed [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] or [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] CSR. - PublicKey public_key = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// A [CertificateDescription][google.cloud.security.privateca.v1.CertificateDescription] describes an X.509 certificate or CSR that has -// been issued, as an alternative to using ASN.1 / X.509. -message CertificateDescription { - // These values describe fields in an issued X.509 certificate such as the - // distinguished name, subject alternative names, serial number, and lifetime. - message SubjectDescription { - // Contains distinguished name fields such as the common name, location and - // / organization. - Subject subject = 1; - - // The subject alternative name fields. - SubjectAltNames subject_alt_name = 2; - - // The serial number encoded in lowercase hexadecimal. - string hex_serial_number = 3; - - // For convenience, the actual lifetime of an issued certificate. - google.protobuf.Duration lifetime = 4; - - // The time at which the certificate becomes valid. - google.protobuf.Timestamp not_before_time = 5; - - // The time after which the certificate is expired. - // Per RFC 5280, the validity period for a certificate is the period of time - // from not_before_time through not_after_time, inclusive. - // Corresponds to 'not_before_time' + 'lifetime' - 1 second. - google.protobuf.Timestamp not_after_time = 6; - } - - // A KeyId identifies a specific public key, usually by hashing the public - // key. - message KeyId { - // Optional. The value of this KeyId encoded in lowercase hexadecimal. This is most - // likely the 160 bit SHA-1 hash of the public key. - string key_id = 1 [(google.api.field_behavior) = OPTIONAL]; - } - - // A group of fingerprints for the x509 certificate. - message CertificateFingerprint { - // The SHA 256 hash, encoded in hexadecimal, of the DER x509 certificate. - string sha256_hash = 1; - } - - // Describes some of the values in a certificate that are related to the - // subject and lifetime. - SubjectDescription subject_description = 1; - - // Describes some of the technical X.509 fields in a certificate. - X509Parameters x509_description = 2; - - // The public key that corresponds to an issued certificate. - PublicKey public_key = 3; - - // Provides a means of identifiying certificates that contain a particular - // public key, per https://tools.ietf.org/html/rfc5280#section-4.2.1.2. - KeyId subject_key_id = 4; - - // Identifies the subject_key_id of the parent certificate, per - // https://tools.ietf.org/html/rfc5280#section-4.2.1.1 - KeyId authority_key_id = 5; - - // Describes a list of locations to obtain CRL information, i.e. - // the DistributionPoint.fullName described by - // https://tools.ietf.org/html/rfc5280#section-4.2.1.13 - repeated string crl_distribution_points = 6; - - // Describes lists of issuer CA certificate URLs that appear in the - // "Authority Information Access" extension in the certificate. - repeated string aia_issuing_certificate_urls = 7; - - // The hash of the x.509 certificate. - CertificateFingerprint cert_fingerprint = 8; -} - -// An [ObjectId][google.cloud.security.privateca.v1.ObjectId] specifies an object identifier (OID). These provide context -// and describe types in ASN.1 messages. -message ObjectId { - // Required. The parts of an OID path. The most significant parts of the path come - // first. - repeated int32 object_id_path = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// An [X509Extension][google.cloud.security.privateca.v1.X509Extension] specifies an X.509 extension, which may be used in -// different parts of X.509 objects like certificates, CSRs, and CRLs. -message X509Extension { - // Required. The OID for this X.509 extension. - ObjectId object_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Indicates whether or not this extension is critical (i.e., if the client - // does not know how to handle this extension, the client should consider this - // to be an error). - bool critical = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Required. The value of this X.509 extension. - bytes value = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// A [KeyUsage][google.cloud.security.privateca.v1.KeyUsage] describes key usage values that may appear in an X.509 -// certificate. -message KeyUsage { - // [KeyUsage.KeyUsageOptions][google.cloud.security.privateca.v1.KeyUsage.KeyUsageOptions] corresponds to the key usage values - // described in https://tools.ietf.org/html/rfc5280#section-4.2.1.3. - message KeyUsageOptions { - // The key may be used for digital signatures. - bool digital_signature = 1; - - // The key may be used for cryptographic commitments. Note that this may - // also be referred to as "non-repudiation". - bool content_commitment = 2; - - // The key may be used to encipher other keys. - bool key_encipherment = 3; - - // The key may be used to encipher data. - bool data_encipherment = 4; - - // The key may be used in a key agreement protocol. - bool key_agreement = 5; - - // The key may be used to sign certificates. - bool cert_sign = 6; - - // The key may be used sign certificate revocation lists. - bool crl_sign = 7; - - // The key may be used to encipher only. - bool encipher_only = 8; - - // The key may be used to decipher only. - bool decipher_only = 9; - } - - // [KeyUsage.ExtendedKeyUsageOptions][google.cloud.security.privateca.v1.KeyUsage.ExtendedKeyUsageOptions] has fields that correspond to - // certain common OIDs that could be specified as an extended key usage value. - message ExtendedKeyUsageOptions { - // Corresponds to OID 1.3.6.1.5.5.7.3.1. Officially described as "TLS WWW - // server authentication", though regularly used for non-WWW TLS. - bool server_auth = 1; - - // Corresponds to OID 1.3.6.1.5.5.7.3.2. Officially described as "TLS WWW - // client authentication", though regularly used for non-WWW TLS. - bool client_auth = 2; - - // Corresponds to OID 1.3.6.1.5.5.7.3.3. Officially described as "Signing of - // downloadable executable code client authentication". - bool code_signing = 3; - - // Corresponds to OID 1.3.6.1.5.5.7.3.4. Officially described as "Email - // protection". - bool email_protection = 4; - - // Corresponds to OID 1.3.6.1.5.5.7.3.8. Officially described as "Binding - // the hash of an object to a time". - bool time_stamping = 5; - - // Corresponds to OID 1.3.6.1.5.5.7.3.9. Officially described as "Signing - // OCSP responses". - bool ocsp_signing = 6; - } - - // Describes high-level ways in which a key may be used. - KeyUsageOptions base_key_usage = 1; - - // Detailed scenarios in which a key may be used. - ExtendedKeyUsageOptions extended_key_usage = 2; - - // Used to describe extended key usages that are not listed in the - // [KeyUsage.ExtendedKeyUsageOptions][google.cloud.security.privateca.v1.KeyUsage.ExtendedKeyUsageOptions] message. - repeated ObjectId unknown_extended_key_usages = 3; -} - -// [Subject][google.cloud.security.privateca.v1.Subject] describes parts of a distinguished name that, in turn, -// describes the subject of the certificate. -message Subject { - // The "common name" of the subject. - string common_name = 1; - - // The country code of the subject. - string country_code = 2; - - // The organization of the subject. - string organization = 3; - - // The organizational_unit of the subject. - string organizational_unit = 4; - - // The locality or city of the subject. - string locality = 5; - - // The province, territory, or regional state of the subject. - string province = 6; - - // The street address of the subject. - string street_address = 7; - - // The postal code of the subject. - string postal_code = 8; -} - -// [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] corresponds to a more modern way of listing what -// the asserted identity is in a certificate (i.e., compared to the "common -// name" in the distinguished name). -message SubjectAltNames { - // Contains only valid, fully-qualified host names. - repeated string dns_names = 1; - - // Contains only valid RFC 3986 URIs. - repeated string uris = 2; - - // Contains only valid RFC 2822 E-mail addresses. - repeated string email_addresses = 3; - - // Contains only valid 32-bit IPv4 addresses or RFC 4291 IPv6 addresses. - repeated string ip_addresses = 4; - - // Contains additional subject alternative name values. - // For each custom_san, the `value` field must contain an ASN.1 encoded - // UTF8String. - repeated X509Extension custom_sans = 5; -} - -// Describes constraints on a [Certificate][google.cloud.security.privateca.v1.Certificate]'s [Subject][google.cloud.security.privateca.v1.Subject] and -// [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames]. -message CertificateIdentityConstraints { - // Optional. A CEL expression that may be used to validate the resolved X.509 Subject - // and/or Subject Alternative Name before a certificate is signed. - // To see the full allowed syntax and some examples, see - // https://cloud.google.com/certificate-authority-service/docs/using-cel - google.type.Expr cel_expression = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Required. If this is true, the [Subject][google.cloud.security.privateca.v1.Subject] field may be copied from a certificate - // request into the signed certificate. Otherwise, the requested [Subject][google.cloud.security.privateca.v1.Subject] - // will be discarded. - optional bool allow_subject_passthrough = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. If this is true, the [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] extension may be copied from a - // certificate request into the signed certificate. Otherwise, the requested - // [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] will be discarded. - optional bool allow_subject_alt_names_passthrough = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Describes a set of X.509 extensions that may be part of some certificate -// issuance controls. -message CertificateExtensionConstraints { - // Describes well-known X.509 extensions that can appear in a [Certificate][google.cloud.security.privateca.v1.Certificate], - // not including the [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] extension. - enum KnownCertificateExtension { - // Not specified. - KNOWN_CERTIFICATE_EXTENSION_UNSPECIFIED = 0; - - // Refers to a certificate's Key Usage extension, as described in [RFC 5280 - // section 4.2.1.3](https://tools.ietf.org/html/rfc5280#section-4.2.1.3). - // This corresponds to the [KeyUsage.base_key_usage][google.cloud.security.privateca.v1.KeyUsage.base_key_usage] field. - BASE_KEY_USAGE = 1; - - // Refers to a certificate's Extended Key Usage extension, as described in - // [RFC 5280 - // section 4.2.1.12](https://tools.ietf.org/html/rfc5280#section-4.2.1.12). - // This corresponds to the [KeyUsage.extended_key_usage][google.cloud.security.privateca.v1.KeyUsage.extended_key_usage] message. - EXTENDED_KEY_USAGE = 2; - - // Refers to a certificate's Basic Constraints extension, as described in - // [RFC 5280 - // section 4.2.1.9](https://tools.ietf.org/html/rfc5280#section-4.2.1.9). - // This corresponds to the [X509Parameters.ca_options][google.cloud.security.privateca.v1.X509Parameters.ca_options] field. - CA_OPTIONS = 3; - - // Refers to a certificate's Policy object identifiers, as described in - // [RFC 5280 - // section 4.2.1.4](https://tools.ietf.org/html/rfc5280#section-4.2.1.4). - // This corresponds to the [X509Parameters.policy_ids][google.cloud.security.privateca.v1.X509Parameters.policy_ids] field. - POLICY_IDS = 4; - - // Refers to OCSP servers in a certificate's Authority Information Access - // extension, as described in - // [RFC 5280 - // section 4.2.2.1](https://tools.ietf.org/html/rfc5280#section-4.2.2.1), - // This corresponds to the [X509Parameters.aia_ocsp_servers][google.cloud.security.privateca.v1.X509Parameters.aia_ocsp_servers] field. - AIA_OCSP_SERVERS = 5; - } - - // Optional. A set of named X.509 extensions. Will be combined with - // [additional_extensions][google.cloud.security.privateca.v1.CertificateExtensionConstraints.additional_extensions] to determine the full set of X.509 extensions. - repeated KnownCertificateExtension known_extensions = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A set of [ObjectIds][google.cloud.security.privateca.v1.ObjectId] identifying custom X.509 extensions. - // Will be combined with [known_extensions][google.cloud.security.privateca.v1.CertificateExtensionConstraints.known_extensions] to determine the full set of - // X.509 extensions. - repeated ObjectId additional_extensions = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// A [RevocationReason][google.cloud.security.privateca.v1.RevocationReason] indicates whether a [Certificate][google.cloud.security.privateca.v1.Certificate] has been revoked, -// and the reason for revocation. These correspond to standard revocation -// reasons from RFC 5280. Note that the enum labels and values in this -// definition are not the same ASN.1 values defined in RFC 5280. These values -// will be translated to the correct ASN.1 values when a CRL is created. -enum RevocationReason { - // Default unspecified value. This value does indicate that a [Certificate][google.cloud.security.privateca.v1.Certificate] - // has been revoked, but that a reason has not been recorded. - REVOCATION_REASON_UNSPECIFIED = 0; - - // Key material for this [Certificate][google.cloud.security.privateca.v1.Certificate] may have leaked. - KEY_COMPROMISE = 1; - - // The key material for a certificate authority in the issuing path may have - // leaked. - CERTIFICATE_AUTHORITY_COMPROMISE = 2; - - // The subject or other attributes in this [Certificate][google.cloud.security.privateca.v1.Certificate] have changed. - AFFILIATION_CHANGED = 3; - - // This [Certificate][google.cloud.security.privateca.v1.Certificate] has been superseded. - SUPERSEDED = 4; - - // This [Certificate][google.cloud.security.privateca.v1.Certificate] or entities in the issuing path have ceased to - // operate. - CESSATION_OF_OPERATION = 5; - - // This [Certificate][google.cloud.security.privateca.v1.Certificate] should not be considered valid, it is expected that it - // may become valid in the future. - CERTIFICATE_HOLD = 6; - - // This [Certificate][google.cloud.security.privateca.v1.Certificate] no longer has permission to assert the listed - // attributes. - PRIVILEGE_WITHDRAWN = 7; - - // The authority which determines appropriate attributes for a [Certificate][google.cloud.security.privateca.v1.Certificate] - // may have been compromised. - ATTRIBUTE_AUTHORITY_COMPROMISE = 8; -} - -// Describes the way in which a [Certificate][google.cloud.security.privateca.v1.Certificate]'s [Subject][google.cloud.security.privateca.v1.Subject] and/or -// [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] will be resolved. -enum SubjectRequestMode { - // Not specified. - SUBJECT_REQUEST_MODE_UNSPECIFIED = 0; - - // The default mode used in most cases. Indicates that the certificate's - // [Subject][google.cloud.security.privateca.v1.Subject] and/or [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] are specified in the certificate - // request. This mode requires the caller to have the - // `privateca.certificates.create` permission. - DEFAULT = 1; - - // A mode reserved for special cases. Indicates that the certificate should - // have one or more SPIFFE [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] set by the service based - // on the caller's identity. This mode will ignore any explicitly specified - // [Subject][google.cloud.security.privateca.v1.Subject] and/or [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] in the certificate request. - // This mode requires the caller to have the - // `privateca.certificates.createForSelf` permission. - REFLECTED_SPIFFE = 2; -} diff --git a/owl-bot-staging/v1/protos/google/cloud/security/privateca/v1/service.proto b/owl-bot-staging/v1/protos/google/cloud/security/privateca/v1/service.proto deleted file mode 100644 index 2ab5953..0000000 --- a/owl-bot-staging/v1/protos/google/cloud/security/privateca/v1/service.proto +++ /dev/null @@ -1,1277 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.security.privateca.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/security/privateca/v1/resources.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Security.PrivateCA.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/security/privateca/v1;privateca"; -option java_multiple_files = true; -option java_outer_classname = "PrivateCaProto"; -option java_package = "com.google.cloud.security.privateca.v1"; -option php_namespace = "Google\\Cloud\\Security\\PrivateCA\\V1"; -option ruby_package = "Google::Cloud::Security::PrivateCA::V1"; - -// [Certificate Authority Service][google.cloud.security.privateca.v1.CertificateAuthorityService] manages private -// certificate authorities and issued certificates. -service CertificateAuthorityService { - option (google.api.default_host) = "privateca.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Create a new [Certificate][google.cloud.security.privateca.v1.Certificate] in a given Project, Location from a particular - // [CaPool][google.cloud.security.privateca.v1.CaPool]. - rpc CreateCertificate(CreateCertificateRequest) returns (Certificate) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*/caPools/*}/certificates" - body: "certificate" - }; - option (google.api.method_signature) = "parent,certificate,certificate_id"; - } - - // Returns a [Certificate][google.cloud.security.privateca.v1.Certificate]. - rpc GetCertificate(GetCertificateRequest) returns (Certificate) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/caPools/*/certificates/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists [Certificates][google.cloud.security.privateca.v1.Certificate]. - rpc ListCertificates(ListCertificatesRequest) returns (ListCertificatesResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/caPools/*}/certificates" - }; - option (google.api.method_signature) = "parent"; - } - - // Revoke a [Certificate][google.cloud.security.privateca.v1.Certificate]. - rpc RevokeCertificate(RevokeCertificateRequest) returns (Certificate) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/caPools/*/certificates/*}:revoke" - body: "*" - }; - option (google.api.method_signature) = "name"; - } - - // Update a [Certificate][google.cloud.security.privateca.v1.Certificate]. Currently, the only field you can update is the - // [labels][google.cloud.security.privateca.v1.Certificate.labels] field. - rpc UpdateCertificate(UpdateCertificateRequest) returns (Certificate) { - option (google.api.http) = { - patch: "/v1/{certificate.name=projects/*/locations/*/caPools/*/certificates/*}" - body: "certificate" - }; - option (google.api.method_signature) = "certificate,update_mask"; - } - - // Activate a [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] that is in state - // [AWAITING_USER_ACTIVATION][google.cloud.security.privateca.v1.CertificateAuthority.State.AWAITING_USER_ACTIVATION] - // and is of type [SUBORDINATE][google.cloud.security.privateca.v1.CertificateAuthority.Type.SUBORDINATE]. After - // the parent Certificate Authority signs a certificate signing request from - // [FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCertificateAuthorityCsr], this method can complete the activation - // process. - rpc ActivateCertificateAuthority(ActivateCertificateAuthorityRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/caPools/*/certificateAuthorities/*}:activate" - body: "*" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "CertificateAuthority" - metadata_type: "OperationMetadata" - }; - } - - // Create a new [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] in a given Project and Location. - rpc CreateCertificateAuthority(CreateCertificateAuthorityRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*/caPools/*}/certificateAuthorities" - body: "certificate_authority" - }; - option (google.api.method_signature) = "parent,certificate_authority,certificate_authority_id"; - option (google.longrunning.operation_info) = { - response_type: "CertificateAuthority" - metadata_type: "OperationMetadata" - }; - } - - // Disable a [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. - rpc DisableCertificateAuthority(DisableCertificateAuthorityRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/caPools/*/certificateAuthorities/*}:disable" - body: "*" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "CertificateAuthority" - metadata_type: "OperationMetadata" - }; - } - - // Enable a [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. - rpc EnableCertificateAuthority(EnableCertificateAuthorityRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/caPools/*/certificateAuthorities/*}:enable" - body: "*" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "CertificateAuthority" - metadata_type: "OperationMetadata" - }; - } - - // Fetch a certificate signing request (CSR) from a [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - // that is in state - // [AWAITING_USER_ACTIVATION][google.cloud.security.privateca.v1.CertificateAuthority.State.AWAITING_USER_ACTIVATION] - // and is of type [SUBORDINATE][google.cloud.security.privateca.v1.CertificateAuthority.Type.SUBORDINATE]. The - // CSR must then be signed by the desired parent Certificate Authority, which - // could be another [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] resource, or could be an on-prem - // certificate authority. See also [ActivateCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.ActivateCertificateAuthority]. - rpc FetchCertificateAuthorityCsr(FetchCertificateAuthorityCsrRequest) returns (FetchCertificateAuthorityCsrResponse) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/caPools/*/certificateAuthorities/*}:fetch" - }; - option (google.api.method_signature) = "name"; - } - - // Returns a [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. - rpc GetCertificateAuthority(GetCertificateAuthorityRequest) returns (CertificateAuthority) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/caPools/*/certificateAuthorities/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority]. - rpc ListCertificateAuthorities(ListCertificateAuthoritiesRequest) returns (ListCertificateAuthoritiesResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/caPools/*}/certificateAuthorities" - }; - option (google.api.method_signature) = "parent"; - } - - // Undelete a [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] that has been deleted. - rpc UndeleteCertificateAuthority(UndeleteCertificateAuthorityRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/caPools/*/certificateAuthorities/*}:undelete" - body: "*" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "CertificateAuthority" - metadata_type: "OperationMetadata" - }; - } - - // Delete a [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. - rpc DeleteCertificateAuthority(DeleteCertificateAuthorityRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/caPools/*/certificateAuthorities/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "CertificateAuthority" - metadata_type: "OperationMetadata" - }; - } - - // Update a [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. - rpc UpdateCertificateAuthority(UpdateCertificateAuthorityRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{certificate_authority.name=projects/*/locations/*/caPools/*/certificateAuthorities/*}" - body: "certificate_authority" - }; - option (google.api.method_signature) = "certificate_authority,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "CertificateAuthority" - metadata_type: "OperationMetadata" - }; - } - - // Create a [CaPool][google.cloud.security.privateca.v1.CaPool]. - rpc CreateCaPool(CreateCaPoolRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/caPools" - body: "ca_pool" - }; - option (google.api.method_signature) = "parent,ca_pool,ca_pool_id"; - option (google.longrunning.operation_info) = { - response_type: "CaPool" - metadata_type: "OperationMetadata" - }; - } - - // Update a [CaPool][google.cloud.security.privateca.v1.CaPool]. - rpc UpdateCaPool(UpdateCaPoolRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{ca_pool.name=projects/*/locations/*/caPools/*}" - body: "ca_pool" - }; - option (google.api.method_signature) = "ca_pool,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "CaPool" - metadata_type: "OperationMetadata" - }; - } - - // Returns a [CaPool][google.cloud.security.privateca.v1.CaPool]. - rpc GetCaPool(GetCaPoolRequest) returns (CaPool) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/caPools/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists [CaPools][google.cloud.security.privateca.v1.CaPool]. - rpc ListCaPools(ListCaPoolsRequest) returns (ListCaPoolsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/caPools" - }; - option (google.api.method_signature) = "parent"; - } - - // Delete a [CaPool][google.cloud.security.privateca.v1.CaPool]. - rpc DeleteCaPool(DeleteCaPoolRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/caPools/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } - - // FetchCaCerts returns the current trust anchor for the [CaPool][google.cloud.security.privateca.v1.CaPool]. This will - // include CA certificate chains for all ACTIVE [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - // resources in the [CaPool][google.cloud.security.privateca.v1.CaPool]. - rpc FetchCaCerts(FetchCaCertsRequest) returns (FetchCaCertsResponse) { - option (google.api.http) = { - post: "/v1/{ca_pool=projects/*/locations/*/caPools/*}:fetchCaCerts" - body: "*" - }; - option (google.api.method_signature) = "ca_pool"; - } - - // Returns a [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList]. - rpc GetCertificateRevocationList(GetCertificateRevocationListRequest) returns (CertificateRevocationList) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/caPools/*/certificateAuthorities/*/certificateRevocationLists/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists [CertificateRevocationLists][google.cloud.security.privateca.v1.CertificateRevocationList]. - rpc ListCertificateRevocationLists(ListCertificateRevocationListsRequest) returns (ListCertificateRevocationListsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/caPools/*/certificateAuthorities/*}/certificateRevocationLists" - }; - option (google.api.method_signature) = "parent"; - } - - // Update a [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList]. - rpc UpdateCertificateRevocationList(UpdateCertificateRevocationListRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{certificate_revocation_list.name=projects/*/locations/*/caPools/*/certificateAuthorities/*/certificateRevocationLists/*}" - body: "certificate_revocation_list" - }; - option (google.api.method_signature) = "certificate_revocation_list,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "CertificateRevocationList" - metadata_type: "OperationMetadata" - }; - } - - // Create a new [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] in a given Project and Location. - rpc CreateCertificateTemplate(CreateCertificateTemplateRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/certificateTemplates" - body: "certificate_template" - }; - option (google.api.method_signature) = "parent,certificate_template,certificate_template_id"; - option (google.longrunning.operation_info) = { - response_type: "CertificateTemplate" - metadata_type: "OperationMetadata" - }; - } - - // DeleteCertificateTemplate deletes a [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate]. - rpc DeleteCertificateTemplate(DeleteCertificateTemplateRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/certificateTemplates/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.cloud.security.privateca.v1.OperationMetadata" - }; - } - - // Returns a [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate]. - rpc GetCertificateTemplate(GetCertificateTemplateRequest) returns (CertificateTemplate) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/certificateTemplates/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists [CertificateTemplates][google.cloud.security.privateca.v1.CertificateTemplate]. - rpc ListCertificateTemplates(ListCertificateTemplatesRequest) returns (ListCertificateTemplatesResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/certificateTemplates" - }; - option (google.api.method_signature) = "parent"; - } - - // Update a [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate]. - rpc UpdateCertificateTemplate(UpdateCertificateTemplateRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{certificate_template.name=projects/*/locations/*/certificateTemplates/*}" - body: "certificate_template" - }; - option (google.api.method_signature) = "certificate_template,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "CertificateTemplate" - metadata_type: "OperationMetadata" - }; - } -} - -// Request message for [CertificateAuthorityService.CreateCertificate][google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCertificate]. -message CreateCertificateRequest { - // Required. The resource name of the [CaPool][google.cloud.security.privateca.v1.CaPool] associated with the [Certificate][google.cloud.security.privateca.v1.Certificate], - // in the format `projects/*/locations/*/caPools/*`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "privateca.googleapis.com/CaPool" - } - ]; - - // Optional. It must be unique within a location and match the regular - // expression `[a-zA-Z0-9_-]{1,63}`. This field is required when using a - // [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] in the Enterprise [CertificateAuthority.Tier][], - // but is optional and its value is ignored otherwise. - string certificate_id = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Required. A [Certificate][google.cloud.security.privateca.v1.Certificate] with initial field values. - Certificate certificate = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. An ID to identify requests. Specify a unique request ID so that if you must - // retry your request, the server will know to ignore the request if it has - // already been completed. The server will guarantee that for at least 60 - // minutes since the first request. - // - // For example, consider a situation where you make an initial request and the - // request times out. If you make the request again with the same request ID, - // the server can check if original operation with the same request ID was - // received, and if so, will ignore the second request. This prevents clients - // from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If this is true, no [Certificate][google.cloud.security.privateca.v1.Certificate] resource will be persisted regardless - // of the [CaPool][google.cloud.security.privateca.v1.CaPool]'s [tier][google.cloud.security.privateca.v1.CaPool.tier], and the returned [Certificate][google.cloud.security.privateca.v1.Certificate] - // will not contain the [pem_certificate][google.cloud.security.privateca.v1.Certificate.pem_certificate] field. - bool validate_only = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The resource ID of the [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] that should issue the - // certificate. This optional field will ignore the load-balancing scheme of - // the Pool and directly issue the certificate from the CA with the specified - // ID, contained in the same [CaPool][google.cloud.security.privateca.v1.CaPool] referenced by `parent`. Per-CA quota - // rules apply. If left empty, a [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] will be chosen from - // the [CaPool][google.cloud.security.privateca.v1.CaPool] by the service. For example, to issue a [Certificate][google.cloud.security.privateca.v1.Certificate] from - // a Certificate Authority with resource name - // "projects/my-project/locations/us-central1/caPools/my-pool/certificateAuthorities/my-ca", - // you can set the [parent][google.cloud.security.privateca.v1.CreateCertificateRequest.parent] to - // "projects/my-project/locations/us-central1/caPools/my-pool" and the - // [issuing_certificate_authority_id][google.cloud.security.privateca.v1.CreateCertificateRequest.issuing_certificate_authority_id] to "my-ca". - string issuing_certificate_authority_id = 6 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [CertificateAuthorityService.GetCertificate][google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificate]. -message GetCertificateRequest { - // Required. The [name][google.cloud.security.privateca.v1.Certificate.name] of the [Certificate][google.cloud.security.privateca.v1.Certificate] to get. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "privateca.googleapis.com/Certificate" - } - ]; -} - -// Request message for [CertificateAuthorityService.ListCertificates][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificates]. -message ListCertificatesRequest { - // Required. The resource name of the location associated with the - // [Certificates][google.cloud.security.privateca.v1.Certificate], in the format - // `projects/*/locations/*/caPools/*`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "privateca.googleapis.com/CaPool" - } - ]; - - // Optional. Limit on the number of - // [Certificates][google.cloud.security.privateca.v1.Certificate] to include in the - // response. Further [Certificates][google.cloud.security.privateca.v1.Certificate] can subsequently be obtained - // by including the - // [ListCertificatesResponse.next_page_token][google.cloud.security.privateca.v1.ListCertificatesResponse.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. Pagination token, returned earlier via - // [ListCertificatesResponse.next_page_token][google.cloud.security.privateca.v1.ListCertificatesResponse.next_page_token]. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Only include resources that match the filter in the response. For details - // on supported filters and syntax, see [Certificates Filtering - // documentation](https://cloud.google.com/certificate-authority-service/docs/sorting-filtering-certificates#filtering_support). - string filter = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specify how the results should be sorted. For details on supported fields - // and syntax, see [Certificates Sorting - // documentation](https://cloud.google.com/certificate-authority-service/docs/sorting-filtering-certificates#sorting_support). - string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for [CertificateAuthorityService.ListCertificates][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificates]. -message ListCertificatesResponse { - // The list of [Certificates][google.cloud.security.privateca.v1.Certificate]. - repeated Certificate certificates = 1; - - // A token to retrieve next page of results. Pass this value in - // [ListCertificatesRequest.next_page_token][] to retrieve the - // next page of results. - string next_page_token = 2; - - // A list of locations (e.g. "us-west1") that could not be reached. - repeated string unreachable = 3; -} - -// Request message for -// [CertificateAuthorityService.RevokeCertificate][google.cloud.security.privateca.v1.CertificateAuthorityService.RevokeCertificate]. -message RevokeCertificateRequest { - // Required. The resource name for this [Certificate][google.cloud.security.privateca.v1.Certificate] in the - // format - // `projects/*/locations/*/caPools/*/certificates/*`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "privateca.googleapis.com/Certificate" - } - ]; - - // Required. The [RevocationReason][google.cloud.security.privateca.v1.RevocationReason] for revoking this certificate. - RevocationReason reason = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. An ID to identify requests. Specify a unique request ID so that if you must - // retry your request, the server will know to ignore the request if it has - // already been completed. The server will guarantee that for at least 60 - // minutes since the first request. - // - // For example, consider a situation where you make an initial request and t - // he request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for [CertificateAuthorityService.UpdateCertificate][google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificate]. -message UpdateCertificateRequest { - // Required. [Certificate][google.cloud.security.privateca.v1.Certificate] with updated values. - Certificate certificate = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. A list of fields to be updated in this request. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. An ID to identify requests. Specify a unique request ID so that if you must - // retry your request, the server will know to ignore the request if it has - // already been completed. The server will guarantee that for at least 60 - // minutes since the first request. - // - // For example, consider a situation where you make an initial request and t - // he request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [CertificateAuthorityService.ActivateCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.ActivateCertificateAuthority]. -message ActivateCertificateAuthorityRequest { - // Required. The resource name for this [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] in the - // format `projects/*/locations/*/caPools/*/certificateAuthorities/*`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "privateca.googleapis.com/CertificateAuthority" - } - ]; - - // Required. The signed CA certificate issued from - // [FetchCertificateAuthorityCsrResponse.pem_csr][google.cloud.security.privateca.v1.FetchCertificateAuthorityCsrResponse.pem_csr]. - string pem_ca_certificate = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Must include information about the issuer of 'pem_ca_certificate', and any - // further issuers until the self-signed CA. - SubordinateConfig subordinate_config = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. An ID to identify requests. Specify a unique request ID so that if you must - // retry your request, the server will know to ignore the request if it has - // already been completed. The server will guarantee that for at least 60 - // minutes since the first request. - // - // For example, consider a situation where you make an initial request and t - // he request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [CertificateAuthorityService.CreateCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCertificateAuthority]. -message CreateCertificateAuthorityRequest { - // Required. The resource name of the [CaPool][google.cloud.security.privateca.v1.CaPool] associated with the - // [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority], in the format - // `projects/*/locations/*/caPools/*`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "privateca.googleapis.com/CaPool" - } - ]; - - // Required. It must be unique within a location and match the regular - // expression `[a-zA-Z0-9_-]{1,63}` - string certificate_authority_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. A [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] with initial field values. - CertificateAuthority certificate_authority = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. An ID to identify requests. Specify a unique request ID so that if you must - // retry your request, the server will know to ignore the request if it has - // already been completed. The server will guarantee that for at least 60 - // minutes since the first request. - // - // For example, consider a situation where you make an initial request and t - // he request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [CertificateAuthorityService.DisableCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.DisableCertificateAuthority]. -message DisableCertificateAuthorityRequest { - // Required. The resource name for this [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] in the - // format `projects/*/locations/*/caPools/*/certificateAuthorities/*`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "privateca.googleapis.com/CertificateAuthority" - } - ]; - - // Optional. An ID to identify requests. Specify a unique request ID so that if you must - // retry your request, the server will know to ignore the request if it has - // already been completed. The server will guarantee that for at least 60 - // minutes since the first request. - // - // For example, consider a situation where you make an initial request and t - // he request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [CertificateAuthorityService.EnableCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.EnableCertificateAuthority]. -message EnableCertificateAuthorityRequest { - // Required. The resource name for this [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] in the - // format `projects/*/locations/*/caPools/*/certificateAuthorities/*`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "privateca.googleapis.com/CertificateAuthority" - } - ]; - - // Optional. An ID to identify requests. Specify a unique request ID so that if you must - // retry your request, the server will know to ignore the request if it has - // already been completed. The server will guarantee that for at least 60 - // minutes since the first request. - // - // For example, consider a situation where you make an initial request and t - // he request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [CertificateAuthorityService.FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCertificateAuthorityCsr]. -message FetchCertificateAuthorityCsrRequest { - // Required. The resource name for this [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] in the - // format `projects/*/locations/*/caPools/*/certificateAuthorities/*`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "privateca.googleapis.com/CertificateAuthority" - } - ]; -} - -// Response message for -// [CertificateAuthorityService.FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCertificateAuthorityCsr]. -message FetchCertificateAuthorityCsrResponse { - // Output only. The PEM-encoded signed certificate signing request (CSR). - string pem_csr = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Request message for [CertificateAuthorityService.GetCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificateAuthority]. -message GetCertificateAuthorityRequest { - // Required. The [name][google.cloud.security.privateca.v1.CertificateAuthority.name] of the [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] to - // get. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "privateca.googleapis.com/CertificateAuthority" - } - ]; -} - -// Request message for -// [CertificateAuthorityService.ListCertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateAuthorities]. -message ListCertificateAuthoritiesRequest { - // Required. The resource name of the [CaPool][google.cloud.security.privateca.v1.CaPool] associated with the - // [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority], in the format - // `projects/*/locations/*/caPools/*`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "privateca.googleapis.com/CaPool" - } - ]; - - // Optional. Limit on the number of [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority] to - // include in the response. - // Further [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority] can subsequently be - // obtained by including the - // [ListCertificateAuthoritiesResponse.next_page_token][google.cloud.security.privateca.v1.ListCertificateAuthoritiesResponse.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. Pagination token, returned earlier via - // [ListCertificateAuthoritiesResponse.next_page_token][google.cloud.security.privateca.v1.ListCertificateAuthoritiesResponse.next_page_token]. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Only include resources that match the filter in the response. - string filter = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specify how the results should be sorted. - string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for -// [CertificateAuthorityService.ListCertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateAuthorities]. -message ListCertificateAuthoritiesResponse { - // The list of [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority]. - repeated CertificateAuthority certificate_authorities = 1; - - // A token to retrieve next page of results. Pass this value in - // [ListCertificateAuthoritiesRequest.next_page_token][] to retrieve the next - // page of results. - string next_page_token = 2; - - // A list of locations (e.g. "us-west1") that could not be reached. - repeated string unreachable = 3; -} - -// Request message for -// [CertificateAuthorityService.UndeleteCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.UndeleteCertificateAuthority]. -message UndeleteCertificateAuthorityRequest { - // Required. The resource name for this [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] in the - // format `projects/*/locations/*/caPools/*/certificateAuthorities/*`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "privateca.googleapis.com/CertificateAuthority" - } - ]; - - // Optional. An ID to identify requests. Specify a unique request ID so that if you must - // retry your request, the server will know to ignore the request if it has - // already been completed. The server will guarantee that for at least 60 - // minutes since the first request. - // - // For example, consider a situation where you make an initial request and t - // he request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [CertificateAuthorityService.DeleteCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.DeleteCertificateAuthority]. -message DeleteCertificateAuthorityRequest { - // Required. The resource name for this [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] in the - // format `projects/*/locations/*/caPools/*/certificateAuthorities/*`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "privateca.googleapis.com/CertificateAuthority" - } - ]; - - // Optional. An ID to identify requests. Specify a unique request ID so that if you must - // retry your request, the server will know to ignore the request if it has - // already been completed. The server will guarantee that for at least 60 - // minutes since the first request. - // - // For example, consider a situation where you make an initial request and t - // he request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. This field allows the CA to be deleted even if the CA has - // active certs. Active certs include both unrevoked and unexpired certs. - bool ignore_active_certificates = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If this flag is set, the Certificate Authority will be deleted as soon as - // possible without a 30-day grace period where undeletion would have been - // allowed. If you proceed, there will be no way to recover this CA. - bool skip_grace_period = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [CertificateAuthorityService.UpdateCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificateAuthority]. -message UpdateCertificateAuthorityRequest { - // Required. [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] with updated values. - CertificateAuthority certificate_authority = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. A list of fields to be updated in this request. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. An ID to identify requests. Specify a unique request ID so that if you must - // retry your request, the server will know to ignore the request if it has - // already been completed. The server will guarantee that for at least 60 - // minutes since the first request. - // - // For example, consider a situation where you make an initial request and t - // he request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [CertificateAuthorityService.CreateCaPool][google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCaPool]. -message CreateCaPoolRequest { - // Required. The resource name of the location associated with the - // [CaPool][google.cloud.security.privateca.v1.CaPool], 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 ca_pool_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. A [CaPool][google.cloud.security.privateca.v1.CaPool] with initial field values. - CaPool ca_pool = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. An ID to identify requests. Specify a unique request ID so that if you must - // retry your request, the server will know to ignore the request if it has - // already been completed. The server will guarantee that for at least 60 - // minutes since the first request. - // - // For example, consider a situation where you make an initial request and t - // he request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [CertificateAuthorityService.UpdateCaPool][google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCaPool]. -message UpdateCaPoolRequest { - // Required. [CaPool][google.cloud.security.privateca.v1.CaPool] with updated values. - CaPool ca_pool = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. A list of fields to be updated in this request. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. An ID to identify requests. Specify a unique request ID so that if you must - // retry your request, the server will know to ignore the request if it has - // already been completed. The server will guarantee that for at least 60 - // minutes since the first request. - // - // For example, consider a situation where you make an initial request and t - // he request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [CertificateAuthorityService.DeleteCaPool][google.cloud.security.privateca.v1.CertificateAuthorityService.DeleteCaPool]. -message DeleteCaPoolRequest { - // Required. The resource name for this [CaPool][google.cloud.security.privateca.v1.CaPool] in the - // format `projects/*/locations/*/caPools/*`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "privateca.googleapis.com/CaPool" - } - ]; - - // Optional. An ID to identify requests. Specify a unique request ID so that if you must - // retry your request, the server will know to ignore the request if it has - // already been completed. The server will guarantee that for at least 60 - // minutes since the first request. - // - // For example, consider a situation where you make an initial request and t - // he request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [CertificateAuthorityService.FetchCaCerts][google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCaCerts]. -message FetchCaCertsRequest { - // Required. The resource name for the [CaPool][google.cloud.security.privateca.v1.CaPool] in the - // format `projects/*/locations/*/caPools/*`. - string ca_pool = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "privateca.googleapis.com/CaPool" - } - ]; - - // Optional. An ID to identify requests. Specify a unique request ID so that if you must - // retry your request, the server will know to ignore the request if it has - // already been completed. The server will guarantee that for at least 60 - // minutes since the first request. - // - // For example, consider a situation where you make an initial request and t - // he request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for -// [CertificateAuthorityService.FetchCaCerts][google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCaCerts]. -message FetchCaCertsResponse { - message CertChain { - // The certificates that form the CA chain, from leaf to root order. - repeated string certificates = 1; - } - - // The PEM encoded CA certificate chains of all - // [ACTIVE][CertificateAuthority.State.ACTIVE] [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - // resources in this [CaPool][google.cloud.security.privateca.v1.CaPool]. - repeated CertChain ca_certs = 1; -} - -// Request message for [CertificateAuthorityService.GetCaPool][google.cloud.security.privateca.v1.CertificateAuthorityService.GetCaPool]. -message GetCaPoolRequest { - // Required. The [name][google.cloud.security.privateca.v1.CaPool.name] of the [CaPool][google.cloud.security.privateca.v1.CaPool] to get. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "privateca.googleapis.com/CaPool" - } - ]; -} - -// Request message for -// [CertificateAuthorityService.ListCaPools][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCaPools]. -message ListCaPoolsRequest { - // Required. The resource name of the location associated with the - // [CaPools][google.cloud.security.privateca.v1.CaPool], in the format - // `projects/*/locations/*`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Optional. Limit on the number of [CaPools][google.cloud.security.privateca.v1.CaPool] to - // include in the response. - // Further [CaPools][google.cloud.security.privateca.v1.CaPool] can subsequently be - // obtained by including the - // [ListCaPoolsResponse.next_page_token][google.cloud.security.privateca.v1.ListCaPoolsResponse.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. Pagination token, returned earlier via - // [ListCaPoolsResponse.next_page_token][google.cloud.security.privateca.v1.ListCaPoolsResponse.next_page_token]. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Only include resources that match the filter in the response. - string filter = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specify how the results should be sorted. - string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for -// [CertificateAuthorityService.ListCaPools][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCaPools]. -message ListCaPoolsResponse { - // The list of [CaPools][google.cloud.security.privateca.v1.CaPool]. - repeated CaPool ca_pools = 1; - - // A token to retrieve next page of results. Pass this value in - // [ListCertificateAuthoritiesRequest.next_page_token][] to retrieve the next - // page of results. - string next_page_token = 2; - - // A list of locations (e.g. "us-west1") that could not be reached. - repeated string unreachable = 3; -} - -// Request message for -// [CertificateAuthorityService.GetCertificateRevocationList][google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificateRevocationList]. -message GetCertificateRevocationListRequest { - // Required. The [name][google.cloud.security.privateca.v1.CertificateRevocationList.name] of the - // [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList] to get. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "privateca.googleapis.com/CertificateRevocationList" - } - ]; -} - -// Request message for -// [CertificateAuthorityService.ListCertificateRevocationLists][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateRevocationLists]. -message ListCertificateRevocationListsRequest { - // Required. The resource name of the location associated with the - // [CertificateRevocationLists][google.cloud.security.privateca.v1.CertificateRevocationList], in the format - // `projects/*/locations/*/caPools/*/certificateAuthorities/*`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "privateca.googleapis.com/CertificateAuthority" - } - ]; - - // Optional. Limit on the number of - // [CertificateRevocationLists][google.cloud.security.privateca.v1.CertificateRevocationList] to include in the - // response. Further [CertificateRevocationLists][google.cloud.security.privateca.v1.CertificateRevocationList] - // can subsequently be obtained by including the - // [ListCertificateRevocationListsResponse.next_page_token][google.cloud.security.privateca.v1.ListCertificateRevocationListsResponse.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. Pagination token, returned earlier via - // [ListCertificateRevocationListsResponse.next_page_token][google.cloud.security.privateca.v1.ListCertificateRevocationListsResponse.next_page_token]. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Only include resources that match the filter in the response. - string filter = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specify how the results should be sorted. - string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for -// [CertificateAuthorityService.ListCertificateRevocationLists][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateRevocationLists]. -message ListCertificateRevocationListsResponse { - // The list of [CertificateRevocationLists][google.cloud.security.privateca.v1.CertificateRevocationList]. - repeated CertificateRevocationList certificate_revocation_lists = 1; - - // A token to retrieve next page of results. Pass this value in - // [ListCertificateRevocationListsRequest.next_page_token][] to retrieve the - // next page of results. - string next_page_token = 2; - - // A list of locations (e.g. "us-west1") that could not be reached. - repeated string unreachable = 3; -} - -// Request message for -// [CertificateAuthorityService.UpdateCertificateRevocationList][google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificateRevocationList]. -message UpdateCertificateRevocationListRequest { - // Required. [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList] with updated values. - CertificateRevocationList certificate_revocation_list = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. A list of fields to be updated in this request. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. An ID to identify requests. Specify a unique request ID so that if you must - // retry your request, the server will know to ignore the request if it has - // already been completed. The server will guarantee that for at least 60 - // minutes since the first request. - // - // For example, consider a situation where you make an initial request and t - // he request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [CertificateAuthorityService.CreateCertificateTemplate][google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCertificateTemplate]. -message CreateCertificateTemplateRequest { - // Required. The resource name of the location associated with the - // [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate], 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 certificate_template_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. A [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] with initial field values. - CertificateTemplate certificate_template = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. An ID to identify requests. Specify a unique request ID so that if you must - // retry your request, the server will know to ignore the request if it has - // already been completed. The server will guarantee that for at least 60 - // minutes since the first request. - // - // For example, consider a situation where you make an initial request and t - // he request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [CertificateAuthorityService.DeleteCertificateTemplate][google.cloud.security.privateca.v1.CertificateAuthorityService.DeleteCertificateTemplate]. -message DeleteCertificateTemplateRequest { - // Required. The resource name for this [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] in the format - // `projects/*/locations/*/certificateTemplates/*`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "privateca.googleapis.com/CertificateTemplate" - } - ]; - - // Optional. An ID to identify requests. Specify a unique request ID so that if you must - // retry your request, the server will know to ignore the request if it has - // already been completed. The server will guarantee that for at least 60 - // minutes since the first request. - // - // For example, consider a situation where you make an initial request and t - // he request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [CertificateAuthorityService.GetCertificateTemplate][google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificateTemplate]. -message GetCertificateTemplateRequest { - // Required. The [name][google.cloud.security.privateca.v1.CertificateTemplate.name] of the [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] to - // get. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "privateca.googleapis.com/CertificateTemplate" - } - ]; -} - -// Request message for -// [CertificateAuthorityService.ListCertificateTemplates][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateTemplates]. -message ListCertificateTemplatesRequest { - // Required. The resource name of the location associated with the - // [CertificateTemplates][google.cloud.security.privateca.v1.CertificateTemplate], in the format - // `projects/*/locations/*`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Optional. Limit on the number of - // [CertificateTemplates][google.cloud.security.privateca.v1.CertificateTemplate] to include in the response. - // Further [CertificateTemplates][google.cloud.security.privateca.v1.CertificateTemplate] can subsequently be - // obtained by including the - // [ListCertificateTemplatesResponse.next_page_token][google.cloud.security.privateca.v1.ListCertificateTemplatesResponse.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. Pagination token, returned earlier via - // [ListCertificateTemplatesResponse.next_page_token][google.cloud.security.privateca.v1.ListCertificateTemplatesResponse.next_page_token]. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Only include resources that match the filter in the response. - string filter = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specify how the results should be sorted. - string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for -// [CertificateAuthorityService.ListCertificateTemplates][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateTemplates]. -message ListCertificateTemplatesResponse { - // The list of [CertificateTemplates][google.cloud.security.privateca.v1.CertificateTemplate]. - repeated CertificateTemplate certificate_templates = 1; - - // A token to retrieve next page of results. Pass this value in - // [ListCertificateTemplatesRequest.next_page_token][] to retrieve - // the next page of results. - string next_page_token = 2; - - // A list of locations (e.g. "us-west1") that could not be reached. - repeated string unreachable = 3; -} - -// Request message for -// [CertificateAuthorityService.UpdateCertificateTemplate][google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificateTemplate]. -message UpdateCertificateTemplateRequest { - // Required. [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] with updated values. - CertificateTemplate certificate_template = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. A list of fields to be updated in this request. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. An ID to identify requests. Specify a unique request ID so that if you must - // retry your request, the server will know to ignore the request if it has - // already been completed. The server will guarantee that for at least 60 - // minutes since the first request. - // - // For example, consider a situation where you make an initial request and t - // he request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Represents the metadata of the long-running operation. -message OperationMetadata { - // Output only. The time the operation was created. - google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the operation finished running. - google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Server-defined resource path for the target of the operation. - string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Name of the verb executed by the operation. - string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Human-readable status of the operation, if any. - string status_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Identifies whether the user has requested cancellation - // of the operation. Operations that have successfully been cancelled - // have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, - // corresponding to `Code.CANCELLED`. - bool requested_cancellation = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. API version used to start the operation. - string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.activate_certificate_authority.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.activate_certificate_authority.js deleted file mode 100644 index b422901..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.activate_certificate_authority.js +++ /dev/null @@ -1,86 +0,0 @@ -// 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, pemCaCertificate, subordinateConfig) { - // [START privateca_v1_generated_CertificateAuthorityService_ActivateCertificateAuthority_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name for this CertificateAuthority google.cloud.security.privateca.v1.CertificateAuthority in the - * format `projects/* /locations/* /caPools/* /certificateAuthorities/*`. - */ - // const name = 'abc123' - /** - * Required. The signed CA certificate issued from - * FetchCertificateAuthorityCsrResponse.pem_csr google.cloud.security.privateca.v1.FetchCertificateAuthorityCsrResponse.pem_csr. - */ - // const pemCaCertificate = 'abc123' - /** - * Required. Must include information about the issuer of 'pem_ca_certificate', and any - * further issuers until the self-signed CA. - */ - // const subordinateConfig = {} - /** - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Privateca library - const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; - - // Instantiates a client - const privatecaClient = new CertificateAuthorityServiceClient(); - - async function callActivateCertificateAuthority() { - // Construct request - const request = { - name, - pemCaCertificate, - subordinateConfig, - }; - - // Run request - const [operation] = await privatecaClient.activateCertificateAuthority(request); - const [response] = await operation.promise(); - console.log(response); - } - - callActivateCertificateAuthority(); - // [END privateca_v1_generated_CertificateAuthorityService_ActivateCertificateAuthority_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.create_ca_pool.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.create_ca_pool.js deleted file mode 100644 index 66013c3..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.create_ca_pool.js +++ /dev/null @@ -1,85 +0,0 @@ -// 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, caPoolId, caPool) { - // [START privateca_v1_generated_CertificateAuthorityService_CreateCaPool_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the location associated with the - * CaPool google.cloud.security.privateca.v1.CaPool, 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 caPoolId = 'abc123' - /** - * Required. A CaPool google.cloud.security.privateca.v1.CaPool with initial field values. - */ - // const caPool = {} - /** - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Privateca library - const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; - - // Instantiates a client - const privatecaClient = new CertificateAuthorityServiceClient(); - - async function callCreateCaPool() { - // Construct request - const request = { - parent, - caPoolId, - caPool, - }; - - // Run request - const [operation] = await privatecaClient.createCaPool(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateCaPool(); - // [END privateca_v1_generated_CertificateAuthorityService_CreateCaPool_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.create_certificate.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.create_certificate.js deleted file mode 100644 index f99164b..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.create_certificate.js +++ /dev/null @@ -1,105 +0,0 @@ -// 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, certificate) { - // [START privateca_v1_generated_CertificateAuthorityService_CreateCertificate_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the CaPool google.cloud.security.privateca.v1.CaPool associated with the Certificate google.cloud.security.privateca.v1.Certificate, - * in the format `projects/* /locations/* /caPools/*`. - */ - // const parent = 'abc123' - /** - * Optional. It must be unique within a location and match the regular - * expression `[a-zA-Z0-9_-]{1,63}`. This field is required when using a - * CertificateAuthority google.cloud.security.privateca.v1.CertificateAuthority in the Enterprise CertificateAuthority.Tier , - * but is optional and its value is ignored otherwise. - */ - // const certificateId = 'abc123' - /** - * Required. A Certificate google.cloud.security.privateca.v1.Certificate with initial field values. - */ - // const certificate = {} - /** - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - /** - * Optional. If this is true, no Certificate google.cloud.security.privateca.v1.Certificate resource will be persisted regardless - * of the CaPool google.cloud.security.privateca.v1.CaPool's tier google.cloud.security.privateca.v1.CaPool.tier, and the returned Certificate google.cloud.security.privateca.v1.Certificate - * will not contain the pem_certificate google.cloud.security.privateca.v1.Certificate.pem_certificate field. - */ - // const validateOnly = true - /** - * Optional. The resource ID of the CertificateAuthority google.cloud.security.privateca.v1.CertificateAuthority that should issue the - * certificate. This optional field will ignore the load-balancing scheme of - * the Pool and directly issue the certificate from the CA with the specified - * ID, contained in the same CaPool google.cloud.security.privateca.v1.CaPool referenced by `parent`. Per-CA quota - * rules apply. If left empty, a CertificateAuthority google.cloud.security.privateca.v1.CertificateAuthority will be chosen from - * the CaPool google.cloud.security.privateca.v1.CaPool by the service. For example, to issue a Certificate google.cloud.security.privateca.v1.Certificate from - * a Certificate Authority with resource name - * "projects/my-project/locations/us-central1/caPools/my-pool/certificateAuthorities/my-ca", - * you can set the parent google.cloud.security.privateca.v1.CreateCertificateRequest.parent to - * "projects/my-project/locations/us-central1/caPools/my-pool" and the - * issuing_certificate_authority_id google.cloud.security.privateca.v1.CreateCertificateRequest.issuing_certificate_authority_id to "my-ca". - */ - // const issuingCertificateAuthorityId = 'abc123' - - // Imports the Privateca library - const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; - - // Instantiates a client - const privatecaClient = new CertificateAuthorityServiceClient(); - - async function callCreateCertificate() { - // Construct request - const request = { - parent, - certificate, - }; - - // Run request - const response = await privatecaClient.createCertificate(request); - console.log(response); - } - - callCreateCertificate(); - // [END privateca_v1_generated_CertificateAuthorityService_CreateCertificate_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.create_certificate_authority.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.create_certificate_authority.js deleted file mode 100644 index ee51d7e..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.create_certificate_authority.js +++ /dev/null @@ -1,86 +0,0 @@ -// 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, certificateAuthorityId, certificateAuthority) { - // [START privateca_v1_generated_CertificateAuthorityService_CreateCertificateAuthority_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the CaPool google.cloud.security.privateca.v1.CaPool associated with the - * CertificateAuthorities google.cloud.security.privateca.v1.CertificateAuthority, in the format - * `projects/* /locations/* /caPools/*`. - */ - // const parent = 'abc123' - /** - * Required. It must be unique within a location and match the regular - * expression `[a-zA-Z0-9_-]{1,63}` - */ - // const certificateAuthorityId = 'abc123' - /** - * Required. A CertificateAuthority google.cloud.security.privateca.v1.CertificateAuthority with initial field values. - */ - // const certificateAuthority = {} - /** - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Privateca library - const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; - - // Instantiates a client - const privatecaClient = new CertificateAuthorityServiceClient(); - - async function callCreateCertificateAuthority() { - // Construct request - const request = { - parent, - certificateAuthorityId, - certificateAuthority, - }; - - // Run request - const [operation] = await privatecaClient.createCertificateAuthority(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateCertificateAuthority(); - // [END privateca_v1_generated_CertificateAuthorityService_CreateCertificateAuthority_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.create_certificate_template.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.create_certificate_template.js deleted file mode 100644 index b719dbf..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.create_certificate_template.js +++ /dev/null @@ -1,86 +0,0 @@ -// 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, certificateTemplateId, certificateTemplate) { - // [START privateca_v1_generated_CertificateAuthorityService_CreateCertificateTemplate_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the location associated with the - * CertificateTemplate google.cloud.security.privateca.v1.CertificateTemplate, 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 certificateTemplateId = 'abc123' - /** - * Required. A CertificateTemplate google.cloud.security.privateca.v1.CertificateTemplate with initial field values. - */ - // const certificateTemplate = {} - /** - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Privateca library - const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; - - // Instantiates a client - const privatecaClient = new CertificateAuthorityServiceClient(); - - async function callCreateCertificateTemplate() { - // Construct request - const request = { - parent, - certificateTemplateId, - certificateTemplate, - }; - - // Run request - const [operation] = await privatecaClient.createCertificateTemplate(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateCertificateTemplate(); - // [END privateca_v1_generated_CertificateAuthorityService_CreateCertificateTemplate_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.delete_ca_pool.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.delete_ca_pool.js deleted file mode 100644 index c106be8..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.delete_ca_pool.js +++ /dev/null @@ -1,74 +0,0 @@ -// 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 privateca_v1_generated_CertificateAuthorityService_DeleteCaPool_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name for this CaPool google.cloud.security.privateca.v1.CaPool in the - * format `projects/* /locations/* /caPools/*`. - */ - // const name = 'abc123' - /** - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Privateca library - const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; - - // Instantiates a client - const privatecaClient = new CertificateAuthorityServiceClient(); - - async function callDeleteCaPool() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await privatecaClient.deleteCaPool(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteCaPool(); - // [END privateca_v1_generated_CertificateAuthorityService_DeleteCaPool_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.delete_certificate_authority.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.delete_certificate_authority.js deleted file mode 100644 index 766bc26..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.delete_certificate_authority.js +++ /dev/null @@ -1,85 +0,0 @@ -// 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 privateca_v1_generated_CertificateAuthorityService_DeleteCertificateAuthority_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name for this CertificateAuthority google.cloud.security.privateca.v1.CertificateAuthority in the - * format `projects/* /locations/* /caPools/* /certificateAuthorities/*`. - */ - // const name = 'abc123' - /** - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - /** - * Optional. This field allows the CA to be deleted even if the CA has - * active certs. Active certs include both unrevoked and unexpired certs. - */ - // const ignoreActiveCertificates = true - /** - * Optional. If this flag is set, the Certificate Authority will be deleted as soon as - * possible without a 30-day grace period where undeletion would have been - * allowed. If you proceed, there will be no way to recover this CA. - */ - // const skipGracePeriod = true - - // Imports the Privateca library - const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; - - // Instantiates a client - const privatecaClient = new CertificateAuthorityServiceClient(); - - async function callDeleteCertificateAuthority() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await privatecaClient.deleteCertificateAuthority(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteCertificateAuthority(); - // [END privateca_v1_generated_CertificateAuthorityService_DeleteCertificateAuthority_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.delete_certificate_template.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.delete_certificate_template.js deleted file mode 100644 index ef9eb37..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.delete_certificate_template.js +++ /dev/null @@ -1,74 +0,0 @@ -// 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 privateca_v1_generated_CertificateAuthorityService_DeleteCertificateTemplate_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name for this CertificateTemplate google.cloud.security.privateca.v1.CertificateTemplate in the format - * `projects/* /locations/* /certificateTemplates/*`. - */ - // const name = 'abc123' - /** - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Privateca library - const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; - - // Instantiates a client - const privatecaClient = new CertificateAuthorityServiceClient(); - - async function callDeleteCertificateTemplate() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await privatecaClient.deleteCertificateTemplate(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteCertificateTemplate(); - // [END privateca_v1_generated_CertificateAuthorityService_DeleteCertificateTemplate_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.disable_certificate_authority.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.disable_certificate_authority.js deleted file mode 100644 index ab2d1a1..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.disable_certificate_authority.js +++ /dev/null @@ -1,74 +0,0 @@ -// 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 privateca_v1_generated_CertificateAuthorityService_DisableCertificateAuthority_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name for this CertificateAuthority google.cloud.security.privateca.v1.CertificateAuthority in the - * format `projects/* /locations/* /caPools/* /certificateAuthorities/*`. - */ - // const name = 'abc123' - /** - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Privateca library - const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; - - // Instantiates a client - const privatecaClient = new CertificateAuthorityServiceClient(); - - async function callDisableCertificateAuthority() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await privatecaClient.disableCertificateAuthority(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDisableCertificateAuthority(); - // [END privateca_v1_generated_CertificateAuthorityService_DisableCertificateAuthority_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.enable_certificate_authority.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.enable_certificate_authority.js deleted file mode 100644 index ea708a6..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.enable_certificate_authority.js +++ /dev/null @@ -1,74 +0,0 @@ -// 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 privateca_v1_generated_CertificateAuthorityService_EnableCertificateAuthority_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name for this CertificateAuthority google.cloud.security.privateca.v1.CertificateAuthority in the - * format `projects/* /locations/* /caPools/* /certificateAuthorities/*`. - */ - // const name = 'abc123' - /** - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Privateca library - const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; - - // Instantiates a client - const privatecaClient = new CertificateAuthorityServiceClient(); - - async function callEnableCertificateAuthority() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await privatecaClient.enableCertificateAuthority(request); - const [response] = await operation.promise(); - console.log(response); - } - - callEnableCertificateAuthority(); - // [END privateca_v1_generated_CertificateAuthorityService_EnableCertificateAuthority_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.fetch_ca_certs.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.fetch_ca_certs.js deleted file mode 100644 index 74ba7d6..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.fetch_ca_certs.js +++ /dev/null @@ -1,73 +0,0 @@ -// 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(caPool) { - // [START privateca_v1_generated_CertificateAuthorityService_FetchCaCerts_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name for the CaPool google.cloud.security.privateca.v1.CaPool in the - * format `projects/* /locations/* /caPools/*`. - */ - // const caPool = 'abc123' - /** - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Privateca library - const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; - - // Instantiates a client - const privatecaClient = new CertificateAuthorityServiceClient(); - - async function callFetchCaCerts() { - // Construct request - const request = { - caPool, - }; - - // Run request - const response = await privatecaClient.fetchCaCerts(request); - console.log(response); - } - - callFetchCaCerts(); - // [END privateca_v1_generated_CertificateAuthorityService_FetchCaCerts_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.fetch_certificate_authority_csr.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.fetch_certificate_authority_csr.js deleted file mode 100644 index 275da0d..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.fetch_certificate_authority_csr.js +++ /dev/null @@ -1,59 +0,0 @@ -// 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 privateca_v1_generated_CertificateAuthorityService_FetchCertificateAuthorityCsr_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name for this CertificateAuthority google.cloud.security.privateca.v1.CertificateAuthority in the - * format `projects/* /locations/* /caPools/* /certificateAuthorities/*`. - */ - // const name = 'abc123' - - // Imports the Privateca library - const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; - - // Instantiates a client - const privatecaClient = new CertificateAuthorityServiceClient(); - - async function callFetchCertificateAuthorityCsr() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await privatecaClient.fetchCertificateAuthorityCsr(request); - console.log(response); - } - - callFetchCertificateAuthorityCsr(); - // [END privateca_v1_generated_CertificateAuthorityService_FetchCertificateAuthorityCsr_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.get_ca_pool.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.get_ca_pool.js deleted file mode 100644 index f189861..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.get_ca_pool.js +++ /dev/null @@ -1,58 +0,0 @@ -// 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 privateca_v1_generated_CertificateAuthorityService_GetCaPool_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name google.cloud.security.privateca.v1.CaPool.name of the CaPool google.cloud.security.privateca.v1.CaPool to get. - */ - // const name = 'abc123' - - // Imports the Privateca library - const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; - - // Instantiates a client - const privatecaClient = new CertificateAuthorityServiceClient(); - - async function callGetCaPool() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await privatecaClient.getCaPool(request); - console.log(response); - } - - callGetCaPool(); - // [END privateca_v1_generated_CertificateAuthorityService_GetCaPool_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.get_certificate.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.get_certificate.js deleted file mode 100644 index 5ba3f39..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.get_certificate.js +++ /dev/null @@ -1,58 +0,0 @@ -// 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 privateca_v1_generated_CertificateAuthorityService_GetCertificate_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name google.cloud.security.privateca.v1.Certificate.name of the Certificate google.cloud.security.privateca.v1.Certificate to get. - */ - // const name = 'abc123' - - // Imports the Privateca library - const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; - - // Instantiates a client - const privatecaClient = new CertificateAuthorityServiceClient(); - - async function callGetCertificate() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await privatecaClient.getCertificate(request); - console.log(response); - } - - callGetCertificate(); - // [END privateca_v1_generated_CertificateAuthorityService_GetCertificate_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.get_certificate_authority.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.get_certificate_authority.js deleted file mode 100644 index 5c42d6b..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.get_certificate_authority.js +++ /dev/null @@ -1,59 +0,0 @@ -// 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 privateca_v1_generated_CertificateAuthorityService_GetCertificateAuthority_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name google.cloud.security.privateca.v1.CertificateAuthority.name of the CertificateAuthority google.cloud.security.privateca.v1.CertificateAuthority to - * get. - */ - // const name = 'abc123' - - // Imports the Privateca library - const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; - - // Instantiates a client - const privatecaClient = new CertificateAuthorityServiceClient(); - - async function callGetCertificateAuthority() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await privatecaClient.getCertificateAuthority(request); - console.log(response); - } - - callGetCertificateAuthority(); - // [END privateca_v1_generated_CertificateAuthorityService_GetCertificateAuthority_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.get_certificate_revocation_list.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.get_certificate_revocation_list.js deleted file mode 100644 index 9d2ca2a..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.get_certificate_revocation_list.js +++ /dev/null @@ -1,59 +0,0 @@ -// 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 privateca_v1_generated_CertificateAuthorityService_GetCertificateRevocationList_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name google.cloud.security.privateca.v1.CertificateRevocationList.name of the - * CertificateRevocationList google.cloud.security.privateca.v1.CertificateRevocationList to get. - */ - // const name = 'abc123' - - // Imports the Privateca library - const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; - - // Instantiates a client - const privatecaClient = new CertificateAuthorityServiceClient(); - - async function callGetCertificateRevocationList() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await privatecaClient.getCertificateRevocationList(request); - console.log(response); - } - - callGetCertificateRevocationList(); - // [END privateca_v1_generated_CertificateAuthorityService_GetCertificateRevocationList_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.get_certificate_template.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.get_certificate_template.js deleted file mode 100644 index 3bbec5e..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.get_certificate_template.js +++ /dev/null @@ -1,59 +0,0 @@ -// 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 privateca_v1_generated_CertificateAuthorityService_GetCertificateTemplate_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name google.cloud.security.privateca.v1.CertificateTemplate.name of the CertificateTemplate google.cloud.security.privateca.v1.CertificateTemplate to - * get. - */ - // const name = 'abc123' - - // Imports the Privateca library - const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; - - // Instantiates a client - const privatecaClient = new CertificateAuthorityServiceClient(); - - async function callGetCertificateTemplate() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await privatecaClient.getCertificateTemplate(request); - console.log(response); - } - - callGetCertificateTemplate(); - // [END privateca_v1_generated_CertificateAuthorityService_GetCertificateTemplate_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.list_ca_pools.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.list_ca_pools.js deleted file mode 100644 index 803be8a..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.list_ca_pools.js +++ /dev/null @@ -1,84 +0,0 @@ -// 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 privateca_v1_generated_CertificateAuthorityService_ListCaPools_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the location associated with the - * CaPools google.cloud.security.privateca.v1.CaPool, in the format - * `projects/* /locations/*`. - */ - // const parent = 'abc123' - /** - * Optional. Limit on the number of CaPools google.cloud.security.privateca.v1.CaPool to - * include in the response. - * Further CaPools google.cloud.security.privateca.v1.CaPool can subsequently be - * obtained by including the - * ListCaPoolsResponse.next_page_token google.cloud.security.privateca.v1.ListCaPoolsResponse.next_page_token in a subsequent - * request. If unspecified, the server will pick an appropriate default. - */ - // const pageSize = 1234 - /** - * Optional. Pagination token, returned earlier via - * ListCaPoolsResponse.next_page_token google.cloud.security.privateca.v1.ListCaPoolsResponse.next_page_token. - */ - // const pageToken = 'abc123' - /** - * Optional. Only include resources that match the filter in the response. - */ - // const filter = 'abc123' - /** - * Optional. Specify how the results should be sorted. - */ - // const orderBy = 'abc123' - - // Imports the Privateca library - const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; - - // Instantiates a client - const privatecaClient = new CertificateAuthorityServiceClient(); - - async function callListCaPools() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await privatecaClient.listCaPoolsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListCaPools(); - // [END privateca_v1_generated_CertificateAuthorityService_ListCaPools_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.list_certificate_authorities.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.list_certificate_authorities.js deleted file mode 100644 index b6ab38d..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.list_certificate_authorities.js +++ /dev/null @@ -1,84 +0,0 @@ -// 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 privateca_v1_generated_CertificateAuthorityService_ListCertificateAuthorities_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the CaPool google.cloud.security.privateca.v1.CaPool associated with the - * CertificateAuthorities google.cloud.security.privateca.v1.CertificateAuthority, in the format - * `projects/* /locations/* /caPools/*`. - */ - // const parent = 'abc123' - /** - * Optional. Limit on the number of CertificateAuthorities google.cloud.security.privateca.v1.CertificateAuthority to - * include in the response. - * Further CertificateAuthorities google.cloud.security.privateca.v1.CertificateAuthority can subsequently be - * obtained by including the - * ListCertificateAuthoritiesResponse.next_page_token google.cloud.security.privateca.v1.ListCertificateAuthoritiesResponse.next_page_token in a subsequent - * request. If unspecified, the server will pick an appropriate default. - */ - // const pageSize = 1234 - /** - * Optional. Pagination token, returned earlier via - * ListCertificateAuthoritiesResponse.next_page_token google.cloud.security.privateca.v1.ListCertificateAuthoritiesResponse.next_page_token. - */ - // const pageToken = 'abc123' - /** - * Optional. Only include resources that match the filter in the response. - */ - // const filter = 'abc123' - /** - * Optional. Specify how the results should be sorted. - */ - // const orderBy = 'abc123' - - // Imports the Privateca library - const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; - - // Instantiates a client - const privatecaClient = new CertificateAuthorityServiceClient(); - - async function callListCertificateAuthorities() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await privatecaClient.listCertificateAuthoritiesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListCertificateAuthorities(); - // [END privateca_v1_generated_CertificateAuthorityService_ListCertificateAuthorities_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.list_certificate_revocation_lists.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.list_certificate_revocation_lists.js deleted file mode 100644 index 92f4b33..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.list_certificate_revocation_lists.js +++ /dev/null @@ -1,84 +0,0 @@ -// 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 privateca_v1_generated_CertificateAuthorityService_ListCertificateRevocationLists_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the location associated with the - * CertificateRevocationLists google.cloud.security.privateca.v1.CertificateRevocationList, in the format - * `projects/* /locations/* /caPools/* /certificateAuthorities/*`. - */ - // const parent = 'abc123' - /** - * Optional. Limit on the number of - * CertificateRevocationLists google.cloud.security.privateca.v1.CertificateRevocationList to include in the - * response. Further CertificateRevocationLists google.cloud.security.privateca.v1.CertificateRevocationList - * can subsequently be obtained by including the - * ListCertificateRevocationListsResponse.next_page_token google.cloud.security.privateca.v1.ListCertificateRevocationListsResponse.next_page_token in a subsequent - * request. If unspecified, the server will pick an appropriate default. - */ - // const pageSize = 1234 - /** - * Optional. Pagination token, returned earlier via - * ListCertificateRevocationListsResponse.next_page_token google.cloud.security.privateca.v1.ListCertificateRevocationListsResponse.next_page_token. - */ - // const pageToken = 'abc123' - /** - * Optional. Only include resources that match the filter in the response. - */ - // const filter = 'abc123' - /** - * Optional. Specify how the results should be sorted. - */ - // const orderBy = 'abc123' - - // Imports the Privateca library - const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; - - // Instantiates a client - const privatecaClient = new CertificateAuthorityServiceClient(); - - async function callListCertificateRevocationLists() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await privatecaClient.listCertificateRevocationListsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListCertificateRevocationLists(); - // [END privateca_v1_generated_CertificateAuthorityService_ListCertificateRevocationLists_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.list_certificate_templates.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.list_certificate_templates.js deleted file mode 100644 index 61c4b29..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.list_certificate_templates.js +++ /dev/null @@ -1,84 +0,0 @@ -// 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 privateca_v1_generated_CertificateAuthorityService_ListCertificateTemplates_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the location associated with the - * CertificateTemplates google.cloud.security.privateca.v1.CertificateTemplate, in the format - * `projects/* /locations/*`. - */ - // const parent = 'abc123' - /** - * Optional. Limit on the number of - * CertificateTemplates google.cloud.security.privateca.v1.CertificateTemplate to include in the response. - * Further CertificateTemplates google.cloud.security.privateca.v1.CertificateTemplate can subsequently be - * obtained by including the - * ListCertificateTemplatesResponse.next_page_token google.cloud.security.privateca.v1.ListCertificateTemplatesResponse.next_page_token in a subsequent - * request. If unspecified, the server will pick an appropriate default. - */ - // const pageSize = 1234 - /** - * Optional. Pagination token, returned earlier via - * ListCertificateTemplatesResponse.next_page_token google.cloud.security.privateca.v1.ListCertificateTemplatesResponse.next_page_token. - */ - // const pageToken = 'abc123' - /** - * Optional. Only include resources that match the filter in the response. - */ - // const filter = 'abc123' - /** - * Optional. Specify how the results should be sorted. - */ - // const orderBy = 'abc123' - - // Imports the Privateca library - const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; - - // Instantiates a client - const privatecaClient = new CertificateAuthorityServiceClient(); - - async function callListCertificateTemplates() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await privatecaClient.listCertificateTemplatesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListCertificateTemplates(); - // [END privateca_v1_generated_CertificateAuthorityService_ListCertificateTemplates_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.list_certificates.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.list_certificates.js deleted file mode 100644 index 8d4b152..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.list_certificates.js +++ /dev/null @@ -1,88 +0,0 @@ -// 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 privateca_v1_generated_CertificateAuthorityService_ListCertificates_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the location associated with the - * Certificates google.cloud.security.privateca.v1.Certificate, in the format - * `projects/* /locations/* /caPools/*`. - */ - // const parent = 'abc123' - /** - * Optional. Limit on the number of - * Certificates google.cloud.security.privateca.v1.Certificate to include in the - * response. Further Certificates google.cloud.security.privateca.v1.Certificate can subsequently be obtained - * by including the - * ListCertificatesResponse.next_page_token google.cloud.security.privateca.v1.ListCertificatesResponse.next_page_token in a subsequent - * request. If unspecified, the server will pick an appropriate default. - */ - // const pageSize = 1234 - /** - * Optional. Pagination token, returned earlier via - * ListCertificatesResponse.next_page_token google.cloud.security.privateca.v1.ListCertificatesResponse.next_page_token. - */ - // const pageToken = 'abc123' - /** - * Optional. Only include resources that match the filter in the response. For details - * on supported filters and syntax, see Certificates Filtering - * documentation (https://cloud.google.com/certificate-authority-service/docs/sorting-filtering-certificates#filtering_support). - */ - // const filter = 'abc123' - /** - * Optional. Specify how the results should be sorted. For details on supported fields - * and syntax, see Certificates Sorting - * documentation (https://cloud.google.com/certificate-authority-service/docs/sorting-filtering-certificates#sorting_support). - */ - // const orderBy = 'abc123' - - // Imports the Privateca library - const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; - - // Instantiates a client - const privatecaClient = new CertificateAuthorityServiceClient(); - - async function callListCertificates() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await privatecaClient.listCertificatesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListCertificates(); - // [END privateca_v1_generated_CertificateAuthorityService_ListCertificates_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.revoke_certificate.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.revoke_certificate.js deleted file mode 100644 index a4776a7..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.revoke_certificate.js +++ /dev/null @@ -1,79 +0,0 @@ -// 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, reason) { - // [START privateca_v1_generated_CertificateAuthorityService_RevokeCertificate_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name for this Certificate google.cloud.security.privateca.v1.Certificate in the - * format - * `projects/* /locations/* /caPools/* /certificates/*`. - */ - // const name = 'abc123' - /** - * Required. The RevocationReason google.cloud.security.privateca.v1.RevocationReason for revoking this certificate. - */ - // const reason = {} - /** - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Privateca library - const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; - - // Instantiates a client - const privatecaClient = new CertificateAuthorityServiceClient(); - - async function callRevokeCertificate() { - // Construct request - const request = { - name, - reason, - }; - - // Run request - const response = await privatecaClient.revokeCertificate(request); - console.log(response); - } - - callRevokeCertificate(); - // [END privateca_v1_generated_CertificateAuthorityService_RevokeCertificate_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.undelete_certificate_authority.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.undelete_certificate_authority.js deleted file mode 100644 index 72949fc..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.undelete_certificate_authority.js +++ /dev/null @@ -1,74 +0,0 @@ -// 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 privateca_v1_generated_CertificateAuthorityService_UndeleteCertificateAuthority_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name for this CertificateAuthority google.cloud.security.privateca.v1.CertificateAuthority in the - * format `projects/* /locations/* /caPools/* /certificateAuthorities/*`. - */ - // const name = 'abc123' - /** - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Privateca library - const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; - - // Instantiates a client - const privatecaClient = new CertificateAuthorityServiceClient(); - - async function callUndeleteCertificateAuthority() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await privatecaClient.undeleteCertificateAuthority(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUndeleteCertificateAuthority(); - // [END privateca_v1_generated_CertificateAuthorityService_UndeleteCertificateAuthority_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.update_ca_pool.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.update_ca_pool.js deleted file mode 100644 index 13c067c..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.update_ca_pool.js +++ /dev/null @@ -1,78 +0,0 @@ -// 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(caPool, updateMask) { - // [START privateca_v1_generated_CertificateAuthorityService_UpdateCaPool_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. CaPool google.cloud.security.privateca.v1.CaPool with updated values. - */ - // const caPool = {} - /** - * Required. A list of fields to be updated in this request. - */ - // const updateMask = {} - /** - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Privateca library - const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; - - // Instantiates a client - const privatecaClient = new CertificateAuthorityServiceClient(); - - async function callUpdateCaPool() { - // Construct request - const request = { - caPool, - updateMask, - }; - - // Run request - const [operation] = await privatecaClient.updateCaPool(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateCaPool(); - // [END privateca_v1_generated_CertificateAuthorityService_UpdateCaPool_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.update_certificate.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.update_certificate.js deleted file mode 100644 index 590b914..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.update_certificate.js +++ /dev/null @@ -1,77 +0,0 @@ -// 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(certificate, updateMask) { - // [START privateca_v1_generated_CertificateAuthorityService_UpdateCertificate_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Certificate google.cloud.security.privateca.v1.Certificate with updated values. - */ - // const certificate = {} - /** - * Required. A list of fields to be updated in this request. - */ - // const updateMask = {} - /** - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Privateca library - const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; - - // Instantiates a client - const privatecaClient = new CertificateAuthorityServiceClient(); - - async function callUpdateCertificate() { - // Construct request - const request = { - certificate, - updateMask, - }; - - // Run request - const response = await privatecaClient.updateCertificate(request); - console.log(response); - } - - callUpdateCertificate(); - // [END privateca_v1_generated_CertificateAuthorityService_UpdateCertificate_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.update_certificate_authority.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.update_certificate_authority.js deleted file mode 100644 index 850c80c..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.update_certificate_authority.js +++ /dev/null @@ -1,78 +0,0 @@ -// 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(certificateAuthority, updateMask) { - // [START privateca_v1_generated_CertificateAuthorityService_UpdateCertificateAuthority_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. CertificateAuthority google.cloud.security.privateca.v1.CertificateAuthority with updated values. - */ - // const certificateAuthority = {} - /** - * Required. A list of fields to be updated in this request. - */ - // const updateMask = {} - /** - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Privateca library - const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; - - // Instantiates a client - const privatecaClient = new CertificateAuthorityServiceClient(); - - async function callUpdateCertificateAuthority() { - // Construct request - const request = { - certificateAuthority, - updateMask, - }; - - // Run request - const [operation] = await privatecaClient.updateCertificateAuthority(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateCertificateAuthority(); - // [END privateca_v1_generated_CertificateAuthorityService_UpdateCertificateAuthority_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.update_certificate_revocation_list.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.update_certificate_revocation_list.js deleted file mode 100644 index 8c71f90..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.update_certificate_revocation_list.js +++ /dev/null @@ -1,78 +0,0 @@ -// 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(certificateRevocationList, updateMask) { - // [START privateca_v1_generated_CertificateAuthorityService_UpdateCertificateRevocationList_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. CertificateRevocationList google.cloud.security.privateca.v1.CertificateRevocationList with updated values. - */ - // const certificateRevocationList = {} - /** - * Required. A list of fields to be updated in this request. - */ - // const updateMask = {} - /** - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Privateca library - const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; - - // Instantiates a client - const privatecaClient = new CertificateAuthorityServiceClient(); - - async function callUpdateCertificateRevocationList() { - // Construct request - const request = { - certificateRevocationList, - updateMask, - }; - - // Run request - const [operation] = await privatecaClient.updateCertificateRevocationList(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateCertificateRevocationList(); - // [END privateca_v1_generated_CertificateAuthorityService_UpdateCertificateRevocationList_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.update_certificate_template.js b/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.update_certificate_template.js deleted file mode 100644 index 727a169..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/certificate_authority_service.update_certificate_template.js +++ /dev/null @@ -1,78 +0,0 @@ -// 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(certificateTemplate, updateMask) { - // [START privateca_v1_generated_CertificateAuthorityService_UpdateCertificateTemplate_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. CertificateTemplate google.cloud.security.privateca.v1.CertificateTemplate with updated values. - */ - // const certificateTemplate = {} - /** - * Required. A list of fields to be updated in this request. - */ - // const updateMask = {} - /** - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Privateca library - const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1; - - // Instantiates a client - const privatecaClient = new CertificateAuthorityServiceClient(); - - async function callUpdateCertificateTemplate() { - // Construct request - const request = { - certificateTemplate, - updateMask, - }; - - // Run request - const [operation] = await privatecaClient.updateCertificateTemplate(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateCertificateTemplate(); - // [END privateca_v1_generated_CertificateAuthorityService_UpdateCertificateTemplate_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.security.privateca.v1.json b/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.security.privateca.v1.json deleted file mode 100644 index b27fdf4..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.security.privateca.v1.json +++ /dev/null @@ -1,1407 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-privateca", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.security.privateca.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "privateca_v1_generated_CertificateAuthorityService_CreateCertificate_async", - "title": "CertificateAuthorityService createCertificate Sample", - "origin": "API_DEFINITION", - "description": " Create a new [Certificate][google.cloud.security.privateca.v1.Certificate] in a given Project, Location from a particular [CaPool][google.cloud.security.privateca.v1.CaPool].", - "canonical": true, - "file": "certificate_authority_service.create_certificate.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 97, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateCertificate", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCertificate", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "certificate_id", - "type": "TYPE_STRING" - }, - { - "name": "certificate", - "type": ".google.cloud.security.privateca.v1.Certificate" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - }, - { - "name": "issuing_certificate_authority_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.security.privateca.v1.Certificate", - "client": { - "shortName": "CertificateAuthorityServiceClient", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" - }, - "method": { - "shortName": "CreateCertificate", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCertificate", - "service": { - "shortName": "CertificateAuthorityService", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" - } - } - } - }, - { - "regionTag": "privateca_v1_generated_CertificateAuthorityService_GetCertificate_async", - "title": "CertificateAuthorityService getCertificate Sample", - "origin": "API_DEFINITION", - "description": " Returns a [Certificate][google.cloud.security.privateca.v1.Certificate].", - "canonical": true, - "file": "certificate_authority_service.get_certificate.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 50, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetCertificate", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificate", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.security.privateca.v1.Certificate", - "client": { - "shortName": "CertificateAuthorityServiceClient", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" - }, - "method": { - "shortName": "GetCertificate", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificate", - "service": { - "shortName": "CertificateAuthorityService", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" - } - } - } - }, - { - "regionTag": "privateca_v1_generated_CertificateAuthorityService_ListCertificates_async", - "title": "CertificateAuthorityService listCertificates Sample", - "origin": "API_DEFINITION", - "description": " Lists [Certificates][google.cloud.security.privateca.v1.Certificate].", - "canonical": true, - "file": "certificate_authority_service.list_certificates.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 80, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListCertificates", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificates", - "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.security.privateca.v1.ListCertificatesResponse", - "client": { - "shortName": "CertificateAuthorityServiceClient", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" - }, - "method": { - "shortName": "ListCertificates", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificates", - "service": { - "shortName": "CertificateAuthorityService", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" - } - } - } - }, - { - "regionTag": "privateca_v1_generated_CertificateAuthorityService_RevokeCertificate_async", - "title": "CertificateAuthorityService revokeCertificate Sample", - "origin": "API_DEFINITION", - "description": " Revoke a [Certificate][google.cloud.security.privateca.v1.Certificate].", - "canonical": true, - "file": "certificate_authority_service.revoke_certificate.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RevokeCertificate", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.RevokeCertificate", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "reason", - "type": ".google.cloud.security.privateca.v1.RevocationReason" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.security.privateca.v1.Certificate", - "client": { - "shortName": "CertificateAuthorityServiceClient", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" - }, - "method": { - "shortName": "RevokeCertificate", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.RevokeCertificate", - "service": { - "shortName": "CertificateAuthorityService", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" - } - } - } - }, - { - "regionTag": "privateca_v1_generated_CertificateAuthorityService_UpdateCertificate_async", - "title": "CertificateAuthorityService updateCertificate Sample", - "origin": "API_DEFINITION", - "description": " Update a [Certificate][google.cloud.security.privateca.v1.Certificate]. Currently, the only field you can update is the [labels][google.cloud.security.privateca.v1.Certificate.labels] field.", - "canonical": true, - "file": "certificate_authority_service.update_certificate.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateCertificate", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificate", - "async": true, - "parameters": [ - { - "name": "certificate", - "type": ".google.cloud.security.privateca.v1.Certificate" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.security.privateca.v1.Certificate", - "client": { - "shortName": "CertificateAuthorityServiceClient", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" - }, - "method": { - "shortName": "UpdateCertificate", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificate", - "service": { - "shortName": "CertificateAuthorityService", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" - } - } - } - }, - { - "regionTag": "privateca_v1_generated_CertificateAuthorityService_ActivateCertificateAuthority_async", - "title": "CertificateAuthorityService activateCertificateAuthority Sample", - "origin": "API_DEFINITION", - "description": " Activate a [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] that is in state [AWAITING_USER_ACTIVATION][google.cloud.security.privateca.v1.CertificateAuthority.State.AWAITING_USER_ACTIVATION] and is of type [SUBORDINATE][google.cloud.security.privateca.v1.CertificateAuthority.Type.SUBORDINATE]. After the parent Certificate Authority signs a certificate signing request from [FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCertificateAuthorityCsr], this method can complete the activation process.", - "canonical": true, - "file": "certificate_authority_service.activate_certificate_authority.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ActivateCertificateAuthority", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.ActivateCertificateAuthority", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "pem_ca_certificate", - "type": "TYPE_STRING" - }, - { - "name": "subordinate_config", - "type": ".google.cloud.security.privateca.v1.SubordinateConfig" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CertificateAuthorityServiceClient", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" - }, - "method": { - "shortName": "ActivateCertificateAuthority", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.ActivateCertificateAuthority", - "service": { - "shortName": "CertificateAuthorityService", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" - } - } - } - }, - { - "regionTag": "privateca_v1_generated_CertificateAuthorityService_CreateCertificateAuthority_async", - "title": "CertificateAuthorityService createCertificateAuthority Sample", - "origin": "API_DEFINITION", - "description": " Create a new [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] in a given Project and Location.", - "canonical": true, - "file": "certificate_authority_service.create_certificate_authority.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateCertificateAuthority", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCertificateAuthority", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "certificate_authority_id", - "type": "TYPE_STRING" - }, - { - "name": "certificate_authority", - "type": ".google.cloud.security.privateca.v1.CertificateAuthority" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CertificateAuthorityServiceClient", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" - }, - "method": { - "shortName": "CreateCertificateAuthority", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCertificateAuthority", - "service": { - "shortName": "CertificateAuthorityService", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" - } - } - } - }, - { - "regionTag": "privateca_v1_generated_CertificateAuthorityService_DisableCertificateAuthority_async", - "title": "CertificateAuthorityService disableCertificateAuthority Sample", - "origin": "API_DEFINITION", - "description": " Disable a [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority].", - "canonical": true, - "file": "certificate_authority_service.disable_certificate_authority.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DisableCertificateAuthority", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.DisableCertificateAuthority", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CertificateAuthorityServiceClient", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" - }, - "method": { - "shortName": "DisableCertificateAuthority", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.DisableCertificateAuthority", - "service": { - "shortName": "CertificateAuthorityService", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" - } - } - } - }, - { - "regionTag": "privateca_v1_generated_CertificateAuthorityService_EnableCertificateAuthority_async", - "title": "CertificateAuthorityService enableCertificateAuthority Sample", - "origin": "API_DEFINITION", - "description": " Enable a [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority].", - "canonical": true, - "file": "certificate_authority_service.enable_certificate_authority.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "EnableCertificateAuthority", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.EnableCertificateAuthority", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CertificateAuthorityServiceClient", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" - }, - "method": { - "shortName": "EnableCertificateAuthority", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.EnableCertificateAuthority", - "service": { - "shortName": "CertificateAuthorityService", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" - } - } - } - }, - { - "regionTag": "privateca_v1_generated_CertificateAuthorityService_FetchCertificateAuthorityCsr_async", - "title": "CertificateAuthorityService fetchCertificateAuthorityCsr Sample", - "origin": "API_DEFINITION", - "description": " Fetch a certificate signing request (CSR) from a [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] that is in state [AWAITING_USER_ACTIVATION][google.cloud.security.privateca.v1.CertificateAuthority.State.AWAITING_USER_ACTIVATION] and is of type [SUBORDINATE][google.cloud.security.privateca.v1.CertificateAuthority.Type.SUBORDINATE]. The CSR must then be signed by the desired parent Certificate Authority, which could be another [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] resource, or could be an on-prem certificate authority. See also [ActivateCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.ActivateCertificateAuthority].", - "canonical": true, - "file": "certificate_authority_service.fetch_certificate_authority_csr.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "FetchCertificateAuthorityCsr", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCertificateAuthorityCsr", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.security.privateca.v1.FetchCertificateAuthorityCsrResponse", - "client": { - "shortName": "CertificateAuthorityServiceClient", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" - }, - "method": { - "shortName": "FetchCertificateAuthorityCsr", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCertificateAuthorityCsr", - "service": { - "shortName": "CertificateAuthorityService", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" - } - } - } - }, - { - "regionTag": "privateca_v1_generated_CertificateAuthorityService_GetCertificateAuthority_async", - "title": "CertificateAuthorityService getCertificateAuthority Sample", - "origin": "API_DEFINITION", - "description": " Returns a [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority].", - "canonical": true, - "file": "certificate_authority_service.get_certificate_authority.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetCertificateAuthority", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificateAuthority", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.security.privateca.v1.CertificateAuthority", - "client": { - "shortName": "CertificateAuthorityServiceClient", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" - }, - "method": { - "shortName": "GetCertificateAuthority", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificateAuthority", - "service": { - "shortName": "CertificateAuthorityService", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" - } - } - } - }, - { - "regionTag": "privateca_v1_generated_CertificateAuthorityService_ListCertificateAuthorities_async", - "title": "CertificateAuthorityService listCertificateAuthorities Sample", - "origin": "API_DEFINITION", - "description": " Lists [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority].", - "canonical": true, - "file": "certificate_authority_service.list_certificate_authorities.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 76, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListCertificateAuthorities", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateAuthorities", - "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.security.privateca.v1.ListCertificateAuthoritiesResponse", - "client": { - "shortName": "CertificateAuthorityServiceClient", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" - }, - "method": { - "shortName": "ListCertificateAuthorities", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateAuthorities", - "service": { - "shortName": "CertificateAuthorityService", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" - } - } - } - }, - { - "regionTag": "privateca_v1_generated_CertificateAuthorityService_UndeleteCertificateAuthority_async", - "title": "CertificateAuthorityService undeleteCertificateAuthority Sample", - "origin": "API_DEFINITION", - "description": " Undelete a [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] that has been deleted.", - "canonical": true, - "file": "certificate_authority_service.undelete_certificate_authority.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UndeleteCertificateAuthority", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.UndeleteCertificateAuthority", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CertificateAuthorityServiceClient", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" - }, - "method": { - "shortName": "UndeleteCertificateAuthority", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.UndeleteCertificateAuthority", - "service": { - "shortName": "CertificateAuthorityService", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" - } - } - } - }, - { - "regionTag": "privateca_v1_generated_CertificateAuthorityService_DeleteCertificateAuthority_async", - "title": "CertificateAuthorityService deleteCertificateAuthority Sample", - "origin": "API_DEFINITION", - "description": " Delete a [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority].", - "canonical": true, - "file": "certificate_authority_service.delete_certificate_authority.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 77, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteCertificateAuthority", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.DeleteCertificateAuthority", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - }, - { - "name": "ignore_active_certificates", - "type": "TYPE_BOOL" - }, - { - "name": "skip_grace_period", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CertificateAuthorityServiceClient", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" - }, - "method": { - "shortName": "DeleteCertificateAuthority", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.DeleteCertificateAuthority", - "service": { - "shortName": "CertificateAuthorityService", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" - } - } - } - }, - { - "regionTag": "privateca_v1_generated_CertificateAuthorityService_UpdateCertificateAuthority_async", - "title": "CertificateAuthorityService updateCertificateAuthority Sample", - "origin": "API_DEFINITION", - "description": " Update a [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority].", - "canonical": true, - "file": "certificate_authority_service.update_certificate_authority.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateCertificateAuthority", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificateAuthority", - "async": true, - "parameters": [ - { - "name": "certificate_authority", - "type": ".google.cloud.security.privateca.v1.CertificateAuthority" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CertificateAuthorityServiceClient", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" - }, - "method": { - "shortName": "UpdateCertificateAuthority", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificateAuthority", - "service": { - "shortName": "CertificateAuthorityService", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" - } - } - } - }, - { - "regionTag": "privateca_v1_generated_CertificateAuthorityService_CreateCaPool_async", - "title": "CertificateAuthorityService createCaPool Sample", - "origin": "API_DEFINITION", - "description": " Create a [CaPool][google.cloud.security.privateca.v1.CaPool].", - "canonical": true, - "file": "certificate_authority_service.create_ca_pool.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 77, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateCaPool", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCaPool", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "ca_pool_id", - "type": "TYPE_STRING" - }, - { - "name": "ca_pool", - "type": ".google.cloud.security.privateca.v1.CaPool" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CertificateAuthorityServiceClient", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" - }, - "method": { - "shortName": "CreateCaPool", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCaPool", - "service": { - "shortName": "CertificateAuthorityService", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" - } - } - } - }, - { - "regionTag": "privateca_v1_generated_CertificateAuthorityService_UpdateCaPool_async", - "title": "CertificateAuthorityService updateCaPool Sample", - "origin": "API_DEFINITION", - "description": " Update a [CaPool][google.cloud.security.privateca.v1.CaPool].", - "canonical": true, - "file": "certificate_authority_service.update_ca_pool.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateCaPool", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCaPool", - "async": true, - "parameters": [ - { - "name": "ca_pool", - "type": ".google.cloud.security.privateca.v1.CaPool" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CertificateAuthorityServiceClient", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" - }, - "method": { - "shortName": "UpdateCaPool", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCaPool", - "service": { - "shortName": "CertificateAuthorityService", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" - } - } - } - }, - { - "regionTag": "privateca_v1_generated_CertificateAuthorityService_GetCaPool_async", - "title": "CertificateAuthorityService getCaPool Sample", - "origin": "API_DEFINITION", - "description": " Returns a [CaPool][google.cloud.security.privateca.v1.CaPool].", - "canonical": true, - "file": "certificate_authority_service.get_ca_pool.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 50, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetCaPool", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.GetCaPool", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.security.privateca.v1.CaPool", - "client": { - "shortName": "CertificateAuthorityServiceClient", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" - }, - "method": { - "shortName": "GetCaPool", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.GetCaPool", - "service": { - "shortName": "CertificateAuthorityService", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" - } - } - } - }, - { - "regionTag": "privateca_v1_generated_CertificateAuthorityService_ListCaPools_async", - "title": "CertificateAuthorityService listCaPools Sample", - "origin": "API_DEFINITION", - "description": " Lists [CaPools][google.cloud.security.privateca.v1.CaPool].", - "canonical": true, - "file": "certificate_authority_service.list_ca_pools.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 76, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListCaPools", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.ListCaPools", - "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.security.privateca.v1.ListCaPoolsResponse", - "client": { - "shortName": "CertificateAuthorityServiceClient", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" - }, - "method": { - "shortName": "ListCaPools", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.ListCaPools", - "service": { - "shortName": "CertificateAuthorityService", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" - } - } - } - }, - { - "regionTag": "privateca_v1_generated_CertificateAuthorityService_DeleteCaPool_async", - "title": "CertificateAuthorityService deleteCaPool Sample", - "origin": "API_DEFINITION", - "description": " Delete a [CaPool][google.cloud.security.privateca.v1.CaPool].", - "canonical": true, - "file": "certificate_authority_service.delete_ca_pool.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteCaPool", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.DeleteCaPool", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CertificateAuthorityServiceClient", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" - }, - "method": { - "shortName": "DeleteCaPool", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.DeleteCaPool", - "service": { - "shortName": "CertificateAuthorityService", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" - } - } - } - }, - { - "regionTag": "privateca_v1_generated_CertificateAuthorityService_FetchCaCerts_async", - "title": "CertificateAuthorityService fetchCaCerts Sample", - "origin": "API_DEFINITION", - "description": " FetchCaCerts returns the current trust anchor for the [CaPool][google.cloud.security.privateca.v1.CaPool]. This will include CA certificate chains for all ACTIVE [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] resources in the [CaPool][google.cloud.security.privateca.v1.CaPool].", - "canonical": true, - "file": "certificate_authority_service.fetch_ca_certs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "FetchCaCerts", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCaCerts", - "async": true, - "parameters": [ - { - "name": "ca_pool", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.security.privateca.v1.FetchCaCertsResponse", - "client": { - "shortName": "CertificateAuthorityServiceClient", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" - }, - "method": { - "shortName": "FetchCaCerts", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCaCerts", - "service": { - "shortName": "CertificateAuthorityService", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" - } - } - } - }, - { - "regionTag": "privateca_v1_generated_CertificateAuthorityService_GetCertificateRevocationList_async", - "title": "CertificateAuthorityService getCertificateRevocationList Sample", - "origin": "API_DEFINITION", - "description": " Returns a [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList].", - "canonical": true, - "file": "certificate_authority_service.get_certificate_revocation_list.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetCertificateRevocationList", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificateRevocationList", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.security.privateca.v1.CertificateRevocationList", - "client": { - "shortName": "CertificateAuthorityServiceClient", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" - }, - "method": { - "shortName": "GetCertificateRevocationList", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificateRevocationList", - "service": { - "shortName": "CertificateAuthorityService", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" - } - } - } - }, - { - "regionTag": "privateca_v1_generated_CertificateAuthorityService_ListCertificateRevocationLists_async", - "title": "CertificateAuthorityService listCertificateRevocationLists Sample", - "origin": "API_DEFINITION", - "description": " Lists [CertificateRevocationLists][google.cloud.security.privateca.v1.CertificateRevocationList].", - "canonical": true, - "file": "certificate_authority_service.list_certificate_revocation_lists.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 76, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListCertificateRevocationLists", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateRevocationLists", - "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.security.privateca.v1.ListCertificateRevocationListsResponse", - "client": { - "shortName": "CertificateAuthorityServiceClient", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" - }, - "method": { - "shortName": "ListCertificateRevocationLists", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateRevocationLists", - "service": { - "shortName": "CertificateAuthorityService", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" - } - } - } - }, - { - "regionTag": "privateca_v1_generated_CertificateAuthorityService_UpdateCertificateRevocationList_async", - "title": "CertificateAuthorityService updateCertificateRevocationList Sample", - "origin": "API_DEFINITION", - "description": " Update a [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList].", - "canonical": true, - "file": "certificate_authority_service.update_certificate_revocation_list.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateCertificateRevocationList", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificateRevocationList", - "async": true, - "parameters": [ - { - "name": "certificate_revocation_list", - "type": ".google.cloud.security.privateca.v1.CertificateRevocationList" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CertificateAuthorityServiceClient", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" - }, - "method": { - "shortName": "UpdateCertificateRevocationList", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificateRevocationList", - "service": { - "shortName": "CertificateAuthorityService", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" - } - } - } - }, - { - "regionTag": "privateca_v1_generated_CertificateAuthorityService_CreateCertificateTemplate_async", - "title": "CertificateAuthorityService createCertificateTemplate Sample", - "origin": "API_DEFINITION", - "description": " Create a new [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] in a given Project and Location.", - "canonical": true, - "file": "certificate_authority_service.create_certificate_template.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateCertificateTemplate", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCertificateTemplate", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "certificate_template_id", - "type": "TYPE_STRING" - }, - { - "name": "certificate_template", - "type": ".google.cloud.security.privateca.v1.CertificateTemplate" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CertificateAuthorityServiceClient", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" - }, - "method": { - "shortName": "CreateCertificateTemplate", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCertificateTemplate", - "service": { - "shortName": "CertificateAuthorityService", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" - } - } - } - }, - { - "regionTag": "privateca_v1_generated_CertificateAuthorityService_DeleteCertificateTemplate_async", - "title": "CertificateAuthorityService deleteCertificateTemplate Sample", - "origin": "API_DEFINITION", - "description": " DeleteCertificateTemplate deletes a [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate].", - "canonical": true, - "file": "certificate_authority_service.delete_certificate_template.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteCertificateTemplate", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.DeleteCertificateTemplate", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CertificateAuthorityServiceClient", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" - }, - "method": { - "shortName": "DeleteCertificateTemplate", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.DeleteCertificateTemplate", - "service": { - "shortName": "CertificateAuthorityService", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" - } - } - } - }, - { - "regionTag": "privateca_v1_generated_CertificateAuthorityService_GetCertificateTemplate_async", - "title": "CertificateAuthorityService getCertificateTemplate Sample", - "origin": "API_DEFINITION", - "description": " Returns a [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate].", - "canonical": true, - "file": "certificate_authority_service.get_certificate_template.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetCertificateTemplate", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificateTemplate", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.security.privateca.v1.CertificateTemplate", - "client": { - "shortName": "CertificateAuthorityServiceClient", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" - }, - "method": { - "shortName": "GetCertificateTemplate", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificateTemplate", - "service": { - "shortName": "CertificateAuthorityService", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" - } - } - } - }, - { - "regionTag": "privateca_v1_generated_CertificateAuthorityService_ListCertificateTemplates_async", - "title": "CertificateAuthorityService listCertificateTemplates Sample", - "origin": "API_DEFINITION", - "description": " Lists [CertificateTemplates][google.cloud.security.privateca.v1.CertificateTemplate].", - "canonical": true, - "file": "certificate_authority_service.list_certificate_templates.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 76, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListCertificateTemplates", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateTemplates", - "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.security.privateca.v1.ListCertificateTemplatesResponse", - "client": { - "shortName": "CertificateAuthorityServiceClient", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" - }, - "method": { - "shortName": "ListCertificateTemplates", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateTemplates", - "service": { - "shortName": "CertificateAuthorityService", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" - } - } - } - }, - { - "regionTag": "privateca_v1_generated_CertificateAuthorityService_UpdateCertificateTemplate_async", - "title": "CertificateAuthorityService updateCertificateTemplate Sample", - "origin": "API_DEFINITION", - "description": " Update a [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate].", - "canonical": true, - "file": "certificate_authority_service.update_certificate_template.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateCertificateTemplate", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificateTemplate", - "async": true, - "parameters": [ - { - "name": "certificate_template", - "type": ".google.cloud.security.privateca.v1.CertificateTemplate" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CertificateAuthorityServiceClient", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityServiceClient" - }, - "method": { - "shortName": "UpdateCertificateTemplate", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificateTemplate", - "service": { - "shortName": "CertificateAuthorityService", - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService" - } - } - } - } - ] -} diff --git a/owl-bot-staging/v1/src/index.ts b/owl-bot-staging/v1/src/index.ts deleted file mode 100644 index eeb96bd..0000000 --- a/owl-bot-staging/v1/src/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -// 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 v1 from './v1'; -const CertificateAuthorityServiceClient = v1.CertificateAuthorityServiceClient; -type CertificateAuthorityServiceClient = v1.CertificateAuthorityServiceClient; -export {v1, CertificateAuthorityServiceClient}; -export default {v1, CertificateAuthorityServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/v1/src/v1/certificate_authority_service_client.ts b/owl-bot-staging/v1/src/v1/certificate_authority_service_client.ts deleted file mode 100644 index 7e6ba33..0000000 --- a/owl-bot-staging/v1/src/v1/certificate_authority_service_client.ts +++ /dev/null @@ -1,4427 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; - -import { Transform } from 'stream'; -import { RequestType } from 'google-gax/build/src/apitypes'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1/certificate_authority_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './certificate_authority_service_client_config.json'; -import { operationsProtos } from 'google-gax'; -const version = require('../../../package.json').version; - -/** - * {@link google.cloud.security.privateca.v1.CertificateAuthorityService|Certificate Authority Service} manages private - * certificate authorities and issued certificates. - * @class - * @memberof v1 - */ -export class CertificateAuthorityServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - iamClient: IamClient; - locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - certificateAuthorityServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of CertificateAuthorityServiceClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof CertificateAuthorityServiceClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.iamClient = new IamClient(this._gaxGrpc, opts); - - this.locationsClient = new LocationsClient(this._gaxGrpc, opts); - - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - caPoolPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/caPools/{ca_pool}' - ), - certificatePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/caPools/{ca_pool}/certificates/{certificate}' - ), - certificateAuthorityPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/caPools/{ca_pool}/certificateAuthorities/{certificate_authority}' - ), - certificateRevocationListPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/caPools/{ca_pool}/certificateAuthorities/{certificate_authority}/certificateRevocationLists/{certificate_revocation_list}' - ), - certificateTemplatePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/certificateTemplates/{certificate_template}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - }; - - // Some of the methods on this service return "paged" results, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listCertificates: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'certificates'), - listCertificateAuthorities: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'certificateAuthorities'), - listCaPools: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'caPools'), - listCertificateRevocationLists: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'certificateRevocationLists'), - listCertificateTemplates: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'certificateTemplates') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1/{resource=projects/*/locations/*/caPools/*}:getIamPolicy',additional_bindings: [{get: '/v1/{resource=projects/*/locations/*/certificateTemplates/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/caPools/*/certificateAuthorities/*/certificateRevocationLists/*}:getIamPolicy',}], - },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/locations/*/caPools/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/certificateTemplates/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/caPools/*/certificateAuthorities/*/certificateRevocationLists/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/locations/*/caPools/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/certificateTemplates/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/caPools/*/certificateAuthorities/*/certificateRevocationLists/*}:testIamPermissions',body: '*',}], - },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const activateCertificateAuthorityResponse = protoFilesRoot.lookup( - '.google.cloud.security.privateca.v1.CertificateAuthority') as gax.protobuf.Type; - const activateCertificateAuthorityMetadata = protoFilesRoot.lookup( - '.google.cloud.security.privateca.v1.OperationMetadata') as gax.protobuf.Type; - const createCertificateAuthorityResponse = protoFilesRoot.lookup( - '.google.cloud.security.privateca.v1.CertificateAuthority') as gax.protobuf.Type; - const createCertificateAuthorityMetadata = protoFilesRoot.lookup( - '.google.cloud.security.privateca.v1.OperationMetadata') as gax.protobuf.Type; - const disableCertificateAuthorityResponse = protoFilesRoot.lookup( - '.google.cloud.security.privateca.v1.CertificateAuthority') as gax.protobuf.Type; - const disableCertificateAuthorityMetadata = protoFilesRoot.lookup( - '.google.cloud.security.privateca.v1.OperationMetadata') as gax.protobuf.Type; - const enableCertificateAuthorityResponse = protoFilesRoot.lookup( - '.google.cloud.security.privateca.v1.CertificateAuthority') as gax.protobuf.Type; - const enableCertificateAuthorityMetadata = protoFilesRoot.lookup( - '.google.cloud.security.privateca.v1.OperationMetadata') as gax.protobuf.Type; - const undeleteCertificateAuthorityResponse = protoFilesRoot.lookup( - '.google.cloud.security.privateca.v1.CertificateAuthority') as gax.protobuf.Type; - const undeleteCertificateAuthorityMetadata = protoFilesRoot.lookup( - '.google.cloud.security.privateca.v1.OperationMetadata') as gax.protobuf.Type; - const deleteCertificateAuthorityResponse = protoFilesRoot.lookup( - '.google.cloud.security.privateca.v1.CertificateAuthority') as gax.protobuf.Type; - const deleteCertificateAuthorityMetadata = protoFilesRoot.lookup( - '.google.cloud.security.privateca.v1.OperationMetadata') as gax.protobuf.Type; - const updateCertificateAuthorityResponse = protoFilesRoot.lookup( - '.google.cloud.security.privateca.v1.CertificateAuthority') as gax.protobuf.Type; - const updateCertificateAuthorityMetadata = protoFilesRoot.lookup( - '.google.cloud.security.privateca.v1.OperationMetadata') as gax.protobuf.Type; - const createCaPoolResponse = protoFilesRoot.lookup( - '.google.cloud.security.privateca.v1.CaPool') as gax.protobuf.Type; - const createCaPoolMetadata = protoFilesRoot.lookup( - '.google.cloud.security.privateca.v1.OperationMetadata') as gax.protobuf.Type; - const updateCaPoolResponse = protoFilesRoot.lookup( - '.google.cloud.security.privateca.v1.CaPool') as gax.protobuf.Type; - const updateCaPoolMetadata = protoFilesRoot.lookup( - '.google.cloud.security.privateca.v1.OperationMetadata') as gax.protobuf.Type; - const deleteCaPoolResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteCaPoolMetadata = protoFilesRoot.lookup( - '.google.cloud.security.privateca.v1.OperationMetadata') as gax.protobuf.Type; - const updateCertificateRevocationListResponse = protoFilesRoot.lookup( - '.google.cloud.security.privateca.v1.CertificateRevocationList') as gax.protobuf.Type; - const updateCertificateRevocationListMetadata = protoFilesRoot.lookup( - '.google.cloud.security.privateca.v1.OperationMetadata') as gax.protobuf.Type; - const createCertificateTemplateResponse = protoFilesRoot.lookup( - '.google.cloud.security.privateca.v1.CertificateTemplate') as gax.protobuf.Type; - const createCertificateTemplateMetadata = protoFilesRoot.lookup( - '.google.cloud.security.privateca.v1.OperationMetadata') as gax.protobuf.Type; - const deleteCertificateTemplateResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteCertificateTemplateMetadata = protoFilesRoot.lookup( - '.google.cloud.security.privateca.v1.OperationMetadata') as gax.protobuf.Type; - const updateCertificateTemplateResponse = protoFilesRoot.lookup( - '.google.cloud.security.privateca.v1.CertificateTemplate') as gax.protobuf.Type; - const updateCertificateTemplateMetadata = protoFilesRoot.lookup( - '.google.cloud.security.privateca.v1.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - activateCertificateAuthority: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - activateCertificateAuthorityResponse.decode.bind(activateCertificateAuthorityResponse), - activateCertificateAuthorityMetadata.decode.bind(activateCertificateAuthorityMetadata)), - createCertificateAuthority: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createCertificateAuthorityResponse.decode.bind(createCertificateAuthorityResponse), - createCertificateAuthorityMetadata.decode.bind(createCertificateAuthorityMetadata)), - disableCertificateAuthority: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - disableCertificateAuthorityResponse.decode.bind(disableCertificateAuthorityResponse), - disableCertificateAuthorityMetadata.decode.bind(disableCertificateAuthorityMetadata)), - enableCertificateAuthority: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - enableCertificateAuthorityResponse.decode.bind(enableCertificateAuthorityResponse), - enableCertificateAuthorityMetadata.decode.bind(enableCertificateAuthorityMetadata)), - undeleteCertificateAuthority: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - undeleteCertificateAuthorityResponse.decode.bind(undeleteCertificateAuthorityResponse), - undeleteCertificateAuthorityMetadata.decode.bind(undeleteCertificateAuthorityMetadata)), - deleteCertificateAuthority: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteCertificateAuthorityResponse.decode.bind(deleteCertificateAuthorityResponse), - deleteCertificateAuthorityMetadata.decode.bind(deleteCertificateAuthorityMetadata)), - updateCertificateAuthority: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateCertificateAuthorityResponse.decode.bind(updateCertificateAuthorityResponse), - updateCertificateAuthorityMetadata.decode.bind(updateCertificateAuthorityMetadata)), - createCaPool: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createCaPoolResponse.decode.bind(createCaPoolResponse), - createCaPoolMetadata.decode.bind(createCaPoolMetadata)), - updateCaPool: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateCaPoolResponse.decode.bind(updateCaPoolResponse), - updateCaPoolMetadata.decode.bind(updateCaPoolMetadata)), - deleteCaPool: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteCaPoolResponse.decode.bind(deleteCaPoolResponse), - deleteCaPoolMetadata.decode.bind(deleteCaPoolMetadata)), - updateCertificateRevocationList: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateCertificateRevocationListResponse.decode.bind(updateCertificateRevocationListResponse), - updateCertificateRevocationListMetadata.decode.bind(updateCertificateRevocationListMetadata)), - createCertificateTemplate: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createCertificateTemplateResponse.decode.bind(createCertificateTemplateResponse), - createCertificateTemplateMetadata.decode.bind(createCertificateTemplateMetadata)), - deleteCertificateTemplate: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteCertificateTemplateResponse.decode.bind(deleteCertificateTemplateResponse), - deleteCertificateTemplateMetadata.decode.bind(deleteCertificateTemplateMetadata)), - updateCertificateTemplate: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateCertificateTemplateResponse.decode.bind(updateCertificateTemplateResponse), - updateCertificateTemplateMetadata.decode.bind(updateCertificateTemplateMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.security.privateca.v1.CertificateAuthorityService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.certificateAuthorityServiceStub) { - return this.certificateAuthorityServiceStub; - } - - // Put together the "service stub" for - // google.cloud.security.privateca.v1.CertificateAuthorityService. - this.certificateAuthorityServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.security.privateca.v1.CertificateAuthorityService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.security.privateca.v1.CertificateAuthorityService, - 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 certificateAuthorityServiceStubMethods = - ['createCertificate', 'getCertificate', 'listCertificates', 'revokeCertificate', 'updateCertificate', 'activateCertificateAuthority', 'createCertificateAuthority', 'disableCertificateAuthority', 'enableCertificateAuthority', 'fetchCertificateAuthorityCsr', 'getCertificateAuthority', 'listCertificateAuthorities', 'undeleteCertificateAuthority', 'deleteCertificateAuthority', 'updateCertificateAuthority', 'createCaPool', 'updateCaPool', 'getCaPool', 'listCaPools', 'deleteCaPool', 'fetchCaCerts', 'getCertificateRevocationList', 'listCertificateRevocationLists', 'updateCertificateRevocationList', 'createCertificateTemplate', 'deleteCertificateTemplate', 'getCertificateTemplate', 'listCertificateTemplates', 'updateCertificateTemplate']; - for (const methodName of certificateAuthorityServiceStubMethods) { - const callPromise = this.certificateAuthorityServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.certificateAuthorityServiceStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'privateca.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 'privateca.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Create a new {@link google.cloud.security.privateca.v1.Certificate|Certificate} in a given Project, Location from a particular - * {@link google.cloud.security.privateca.v1.CaPool|CaPool}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the {@link google.cloud.security.privateca.v1.CaPool|CaPool} associated with the {@link google.cloud.security.privateca.v1.Certificate|Certificate}, - * in the format `projects/* /locations/* /caPools/*`. - * @param {string} [request.certificateId] - * Optional. It must be unique within a location and match the regular - * expression `[a-zA-Z0-9_-]{1,63}`. This field is required when using a - * {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthority} in the Enterprise {@link |CertificateAuthority.Tier}, - * but is optional and its value is ignored otherwise. - * @param {google.cloud.security.privateca.v1.Certificate} request.certificate - * Required. A {@link google.cloud.security.privateca.v1.Certificate|Certificate} with initial field values. - * @param {string} [request.requestId] - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {boolean} [request.validateOnly] - * Optional. If this is true, no {@link google.cloud.security.privateca.v1.Certificate|Certificate} resource will be persisted regardless - * of the {@link google.cloud.security.privateca.v1.CaPool|CaPool}'s {@link google.cloud.security.privateca.v1.CaPool.tier|tier}, and the returned {@link google.cloud.security.privateca.v1.Certificate|Certificate} - * will not contain the {@link google.cloud.security.privateca.v1.Certificate.pem_certificate|pem_certificate} field. - * @param {string} [request.issuingCertificateAuthorityId] - * Optional. The resource ID of the {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthority} that should issue the - * certificate. This optional field will ignore the load-balancing scheme of - * the Pool and directly issue the certificate from the CA with the specified - * ID, contained in the same {@link google.cloud.security.privateca.v1.CaPool|CaPool} referenced by `parent`. Per-CA quota - * rules apply. If left empty, a {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthority} will be chosen from - * the {@link google.cloud.security.privateca.v1.CaPool|CaPool} by the service. For example, to issue a {@link google.cloud.security.privateca.v1.Certificate|Certificate} from - * a Certificate Authority with resource name - * "projects/my-project/locations/us-central1/caPools/my-pool/certificateAuthorities/my-ca", - * you can set the {@link google.cloud.security.privateca.v1.CreateCertificateRequest.parent|parent} to - * "projects/my-project/locations/us-central1/caPools/my-pool" and the - * {@link google.cloud.security.privateca.v1.CreateCertificateRequest.issuing_certificate_authority_id|issuing_certificate_authority_id} to "my-ca". - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [Certificate]{@link google.cloud.security.privateca.v1.Certificate}. - * 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/certificate_authority_service.create_certificate.js - * region_tag:privateca_v1_generated_CertificateAuthorityService_CreateCertificate_async - */ - createCertificate( - request?: protos.google.cloud.security.privateca.v1.ICreateCertificateRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.security.privateca.v1.ICertificate, - protos.google.cloud.security.privateca.v1.ICreateCertificateRequest|undefined, {}|undefined - ]>; - createCertificate( - request: protos.google.cloud.security.privateca.v1.ICreateCertificateRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.security.privateca.v1.ICertificate, - protos.google.cloud.security.privateca.v1.ICreateCertificateRequest|null|undefined, - {}|null|undefined>): void; - createCertificate( - request: protos.google.cloud.security.privateca.v1.ICreateCertificateRequest, - callback: Callback< - protos.google.cloud.security.privateca.v1.ICertificate, - protos.google.cloud.security.privateca.v1.ICreateCertificateRequest|null|undefined, - {}|null|undefined>): void; - createCertificate( - request?: protos.google.cloud.security.privateca.v1.ICreateCertificateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.security.privateca.v1.ICertificate, - protos.google.cloud.security.privateca.v1.ICreateCertificateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.security.privateca.v1.ICertificate, - protos.google.cloud.security.privateca.v1.ICreateCertificateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.security.privateca.v1.ICertificate, - protos.google.cloud.security.privateca.v1.ICreateCertificateRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createCertificate(request, options, callback); - } -/** - * Returns a {@link google.cloud.security.privateca.v1.Certificate|Certificate}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The {@link google.cloud.security.privateca.v1.Certificate.name|name} of the {@link google.cloud.security.privateca.v1.Certificate|Certificate} 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 [Certificate]{@link google.cloud.security.privateca.v1.Certificate}. - * 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/certificate_authority_service.get_certificate.js - * region_tag:privateca_v1_generated_CertificateAuthorityService_GetCertificate_async - */ - getCertificate( - request?: protos.google.cloud.security.privateca.v1.IGetCertificateRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.security.privateca.v1.ICertificate, - protos.google.cloud.security.privateca.v1.IGetCertificateRequest|undefined, {}|undefined - ]>; - getCertificate( - request: protos.google.cloud.security.privateca.v1.IGetCertificateRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.security.privateca.v1.ICertificate, - protos.google.cloud.security.privateca.v1.IGetCertificateRequest|null|undefined, - {}|null|undefined>): void; - getCertificate( - request: protos.google.cloud.security.privateca.v1.IGetCertificateRequest, - callback: Callback< - protos.google.cloud.security.privateca.v1.ICertificate, - protos.google.cloud.security.privateca.v1.IGetCertificateRequest|null|undefined, - {}|null|undefined>): void; - getCertificate( - request?: protos.google.cloud.security.privateca.v1.IGetCertificateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.security.privateca.v1.ICertificate, - protos.google.cloud.security.privateca.v1.IGetCertificateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.security.privateca.v1.ICertificate, - protos.google.cloud.security.privateca.v1.IGetCertificateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.security.privateca.v1.ICertificate, - protos.google.cloud.security.privateca.v1.IGetCertificateRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getCertificate(request, options, callback); - } -/** - * Revoke a {@link google.cloud.security.privateca.v1.Certificate|Certificate}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name for this {@link google.cloud.security.privateca.v1.Certificate|Certificate} in the - * format - * `projects/* /locations/* /caPools/* /certificates/*`. - * @param {google.cloud.security.privateca.v1.RevocationReason} request.reason - * Required. The {@link google.cloud.security.privateca.v1.RevocationReason|RevocationReason} for revoking this certificate. - * @param {string} [request.requestId] - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [Certificate]{@link google.cloud.security.privateca.v1.Certificate}. - * 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/certificate_authority_service.revoke_certificate.js - * region_tag:privateca_v1_generated_CertificateAuthorityService_RevokeCertificate_async - */ - revokeCertificate( - request?: protos.google.cloud.security.privateca.v1.IRevokeCertificateRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.security.privateca.v1.ICertificate, - protos.google.cloud.security.privateca.v1.IRevokeCertificateRequest|undefined, {}|undefined - ]>; - revokeCertificate( - request: protos.google.cloud.security.privateca.v1.IRevokeCertificateRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.security.privateca.v1.ICertificate, - protos.google.cloud.security.privateca.v1.IRevokeCertificateRequest|null|undefined, - {}|null|undefined>): void; - revokeCertificate( - request: protos.google.cloud.security.privateca.v1.IRevokeCertificateRequest, - callback: Callback< - protos.google.cloud.security.privateca.v1.ICertificate, - protos.google.cloud.security.privateca.v1.IRevokeCertificateRequest|null|undefined, - {}|null|undefined>): void; - revokeCertificate( - request?: protos.google.cloud.security.privateca.v1.IRevokeCertificateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.security.privateca.v1.ICertificate, - protos.google.cloud.security.privateca.v1.IRevokeCertificateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.security.privateca.v1.ICertificate, - protos.google.cloud.security.privateca.v1.IRevokeCertificateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.security.privateca.v1.ICertificate, - protos.google.cloud.security.privateca.v1.IRevokeCertificateRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.revokeCertificate(request, options, callback); - } -/** - * Update a {@link google.cloud.security.privateca.v1.Certificate|Certificate}. Currently, the only field you can update is the - * {@link google.cloud.security.privateca.v1.Certificate.labels|labels} field. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.security.privateca.v1.Certificate} request.certificate - * Required. {@link google.cloud.security.privateca.v1.Certificate|Certificate} with updated values. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. A list of fields to be updated in this request. - * @param {string} [request.requestId] - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [Certificate]{@link google.cloud.security.privateca.v1.Certificate}. - * 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/certificate_authority_service.update_certificate.js - * region_tag:privateca_v1_generated_CertificateAuthorityService_UpdateCertificate_async - */ - updateCertificate( - request?: protos.google.cloud.security.privateca.v1.IUpdateCertificateRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.security.privateca.v1.ICertificate, - protos.google.cloud.security.privateca.v1.IUpdateCertificateRequest|undefined, {}|undefined - ]>; - updateCertificate( - request: protos.google.cloud.security.privateca.v1.IUpdateCertificateRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.security.privateca.v1.ICertificate, - protos.google.cloud.security.privateca.v1.IUpdateCertificateRequest|null|undefined, - {}|null|undefined>): void; - updateCertificate( - request: protos.google.cloud.security.privateca.v1.IUpdateCertificateRequest, - callback: Callback< - protos.google.cloud.security.privateca.v1.ICertificate, - protos.google.cloud.security.privateca.v1.IUpdateCertificateRequest|null|undefined, - {}|null|undefined>): void; - updateCertificate( - request?: protos.google.cloud.security.privateca.v1.IUpdateCertificateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.security.privateca.v1.ICertificate, - protos.google.cloud.security.privateca.v1.IUpdateCertificateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.security.privateca.v1.ICertificate, - protos.google.cloud.security.privateca.v1.IUpdateCertificateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.security.privateca.v1.ICertificate, - protos.google.cloud.security.privateca.v1.IUpdateCertificateRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'certificate.name': request.certificate!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateCertificate(request, options, callback); - } -/** - * Fetch a certificate signing request (CSR) from a {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthority} - * that is in state - * {@link google.cloud.security.privateca.v1.CertificateAuthority.State.AWAITING_USER_ACTIVATION|AWAITING_USER_ACTIVATION} - * and is of type {@link google.cloud.security.privateca.v1.CertificateAuthority.Type.SUBORDINATE|SUBORDINATE}. The - * CSR must then be signed by the desired parent Certificate Authority, which - * could be another {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthority} resource, or could be an on-prem - * certificate authority. See also {@link google.cloud.security.privateca.v1.CertificateAuthorityService.ActivateCertificateAuthority|ActivateCertificateAuthority}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name for this {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthority} in the - * format `projects/* /locations/* /caPools/* /certificateAuthorities/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [FetchCertificateAuthorityCsrResponse]{@link google.cloud.security.privateca.v1.FetchCertificateAuthorityCsrResponse}. - * 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/certificate_authority_service.fetch_certificate_authority_csr.js - * region_tag:privateca_v1_generated_CertificateAuthorityService_FetchCertificateAuthorityCsr_async - */ - fetchCertificateAuthorityCsr( - request?: protos.google.cloud.security.privateca.v1.IFetchCertificateAuthorityCsrRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.security.privateca.v1.IFetchCertificateAuthorityCsrResponse, - protos.google.cloud.security.privateca.v1.IFetchCertificateAuthorityCsrRequest|undefined, {}|undefined - ]>; - fetchCertificateAuthorityCsr( - request: protos.google.cloud.security.privateca.v1.IFetchCertificateAuthorityCsrRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.security.privateca.v1.IFetchCertificateAuthorityCsrResponse, - protos.google.cloud.security.privateca.v1.IFetchCertificateAuthorityCsrRequest|null|undefined, - {}|null|undefined>): void; - fetchCertificateAuthorityCsr( - request: protos.google.cloud.security.privateca.v1.IFetchCertificateAuthorityCsrRequest, - callback: Callback< - protos.google.cloud.security.privateca.v1.IFetchCertificateAuthorityCsrResponse, - protos.google.cloud.security.privateca.v1.IFetchCertificateAuthorityCsrRequest|null|undefined, - {}|null|undefined>): void; - fetchCertificateAuthorityCsr( - request?: protos.google.cloud.security.privateca.v1.IFetchCertificateAuthorityCsrRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.security.privateca.v1.IFetchCertificateAuthorityCsrResponse, - protos.google.cloud.security.privateca.v1.IFetchCertificateAuthorityCsrRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.security.privateca.v1.IFetchCertificateAuthorityCsrResponse, - protos.google.cloud.security.privateca.v1.IFetchCertificateAuthorityCsrRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.security.privateca.v1.IFetchCertificateAuthorityCsrResponse, - protos.google.cloud.security.privateca.v1.IFetchCertificateAuthorityCsrRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.fetchCertificateAuthorityCsr(request, options, callback); - } -/** - * Returns a {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthority}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The {@link google.cloud.security.privateca.v1.CertificateAuthority.name|name} of the {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthority} 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 [CertificateAuthority]{@link google.cloud.security.privateca.v1.CertificateAuthority}. - * 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/certificate_authority_service.get_certificate_authority.js - * region_tag:privateca_v1_generated_CertificateAuthorityService_GetCertificateAuthority_async - */ - getCertificateAuthority( - request?: protos.google.cloud.security.privateca.v1.IGetCertificateAuthorityRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.security.privateca.v1.ICertificateAuthority, - protos.google.cloud.security.privateca.v1.IGetCertificateAuthorityRequest|undefined, {}|undefined - ]>; - getCertificateAuthority( - request: protos.google.cloud.security.privateca.v1.IGetCertificateAuthorityRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.security.privateca.v1.ICertificateAuthority, - protos.google.cloud.security.privateca.v1.IGetCertificateAuthorityRequest|null|undefined, - {}|null|undefined>): void; - getCertificateAuthority( - request: protos.google.cloud.security.privateca.v1.IGetCertificateAuthorityRequest, - callback: Callback< - protos.google.cloud.security.privateca.v1.ICertificateAuthority, - protos.google.cloud.security.privateca.v1.IGetCertificateAuthorityRequest|null|undefined, - {}|null|undefined>): void; - getCertificateAuthority( - request?: protos.google.cloud.security.privateca.v1.IGetCertificateAuthorityRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.security.privateca.v1.ICertificateAuthority, - protos.google.cloud.security.privateca.v1.IGetCertificateAuthorityRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.security.privateca.v1.ICertificateAuthority, - protos.google.cloud.security.privateca.v1.IGetCertificateAuthorityRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.security.privateca.v1.ICertificateAuthority, - protos.google.cloud.security.privateca.v1.IGetCertificateAuthorityRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getCertificateAuthority(request, options, callback); - } -/** - * Returns a {@link google.cloud.security.privateca.v1.CaPool|CaPool}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The {@link google.cloud.security.privateca.v1.CaPool.name|name} of the {@link google.cloud.security.privateca.v1.CaPool|CaPool} 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 [CaPool]{@link google.cloud.security.privateca.v1.CaPool}. - * 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/certificate_authority_service.get_ca_pool.js - * region_tag:privateca_v1_generated_CertificateAuthorityService_GetCaPool_async - */ - getCaPool( - request?: protos.google.cloud.security.privateca.v1.IGetCaPoolRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.security.privateca.v1.ICaPool, - protos.google.cloud.security.privateca.v1.IGetCaPoolRequest|undefined, {}|undefined - ]>; - getCaPool( - request: protos.google.cloud.security.privateca.v1.IGetCaPoolRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.security.privateca.v1.ICaPool, - protos.google.cloud.security.privateca.v1.IGetCaPoolRequest|null|undefined, - {}|null|undefined>): void; - getCaPool( - request: protos.google.cloud.security.privateca.v1.IGetCaPoolRequest, - callback: Callback< - protos.google.cloud.security.privateca.v1.ICaPool, - protos.google.cloud.security.privateca.v1.IGetCaPoolRequest|null|undefined, - {}|null|undefined>): void; - getCaPool( - request?: protos.google.cloud.security.privateca.v1.IGetCaPoolRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.security.privateca.v1.ICaPool, - protos.google.cloud.security.privateca.v1.IGetCaPoolRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.security.privateca.v1.ICaPool, - protos.google.cloud.security.privateca.v1.IGetCaPoolRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.security.privateca.v1.ICaPool, - protos.google.cloud.security.privateca.v1.IGetCaPoolRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getCaPool(request, options, callback); - } -/** - * FetchCaCerts returns the current trust anchor for the {@link google.cloud.security.privateca.v1.CaPool|CaPool}. This will - * include CA certificate chains for all ACTIVE {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthority} - * resources in the {@link google.cloud.security.privateca.v1.CaPool|CaPool}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.caPool - * Required. The resource name for the {@link google.cloud.security.privateca.v1.CaPool|CaPool} in the - * format `projects/* /locations/* /caPools/*`. - * @param {string} [request.requestId] - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [FetchCaCertsResponse]{@link google.cloud.security.privateca.v1.FetchCaCertsResponse}. - * 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/certificate_authority_service.fetch_ca_certs.js - * region_tag:privateca_v1_generated_CertificateAuthorityService_FetchCaCerts_async - */ - fetchCaCerts( - request?: protos.google.cloud.security.privateca.v1.IFetchCaCertsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.security.privateca.v1.IFetchCaCertsResponse, - protos.google.cloud.security.privateca.v1.IFetchCaCertsRequest|undefined, {}|undefined - ]>; - fetchCaCerts( - request: protos.google.cloud.security.privateca.v1.IFetchCaCertsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.security.privateca.v1.IFetchCaCertsResponse, - protos.google.cloud.security.privateca.v1.IFetchCaCertsRequest|null|undefined, - {}|null|undefined>): void; - fetchCaCerts( - request: protos.google.cloud.security.privateca.v1.IFetchCaCertsRequest, - callback: Callback< - protos.google.cloud.security.privateca.v1.IFetchCaCertsResponse, - protos.google.cloud.security.privateca.v1.IFetchCaCertsRequest|null|undefined, - {}|null|undefined>): void; - fetchCaCerts( - request?: protos.google.cloud.security.privateca.v1.IFetchCaCertsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.security.privateca.v1.IFetchCaCertsResponse, - protos.google.cloud.security.privateca.v1.IFetchCaCertsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.security.privateca.v1.IFetchCaCertsResponse, - protos.google.cloud.security.privateca.v1.IFetchCaCertsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.security.privateca.v1.IFetchCaCertsResponse, - protos.google.cloud.security.privateca.v1.IFetchCaCertsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'ca_pool': request.caPool || '', - }); - this.initialize(); - return this.innerApiCalls.fetchCaCerts(request, options, callback); - } -/** - * Returns a {@link google.cloud.security.privateca.v1.CertificateRevocationList|CertificateRevocationList}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The {@link google.cloud.security.privateca.v1.CertificateRevocationList.name|name} of the - * {@link google.cloud.security.privateca.v1.CertificateRevocationList|CertificateRevocationList} 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 [CertificateRevocationList]{@link google.cloud.security.privateca.v1.CertificateRevocationList}. - * 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/certificate_authority_service.get_certificate_revocation_list.js - * region_tag:privateca_v1_generated_CertificateAuthorityService_GetCertificateRevocationList_async - */ - getCertificateRevocationList( - request?: protos.google.cloud.security.privateca.v1.IGetCertificateRevocationListRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.security.privateca.v1.ICertificateRevocationList, - protos.google.cloud.security.privateca.v1.IGetCertificateRevocationListRequest|undefined, {}|undefined - ]>; - getCertificateRevocationList( - request: protos.google.cloud.security.privateca.v1.IGetCertificateRevocationListRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.security.privateca.v1.ICertificateRevocationList, - protos.google.cloud.security.privateca.v1.IGetCertificateRevocationListRequest|null|undefined, - {}|null|undefined>): void; - getCertificateRevocationList( - request: protos.google.cloud.security.privateca.v1.IGetCertificateRevocationListRequest, - callback: Callback< - protos.google.cloud.security.privateca.v1.ICertificateRevocationList, - protos.google.cloud.security.privateca.v1.IGetCertificateRevocationListRequest|null|undefined, - {}|null|undefined>): void; - getCertificateRevocationList( - request?: protos.google.cloud.security.privateca.v1.IGetCertificateRevocationListRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.security.privateca.v1.ICertificateRevocationList, - protos.google.cloud.security.privateca.v1.IGetCertificateRevocationListRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.security.privateca.v1.ICertificateRevocationList, - protos.google.cloud.security.privateca.v1.IGetCertificateRevocationListRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.security.privateca.v1.ICertificateRevocationList, - protos.google.cloud.security.privateca.v1.IGetCertificateRevocationListRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getCertificateRevocationList(request, options, callback); - } -/** - * Returns a {@link google.cloud.security.privateca.v1.CertificateTemplate|CertificateTemplate}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The {@link google.cloud.security.privateca.v1.CertificateTemplate.name|name} of the {@link google.cloud.security.privateca.v1.CertificateTemplate|CertificateTemplate} 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 [CertificateTemplate]{@link google.cloud.security.privateca.v1.CertificateTemplate}. - * 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/certificate_authority_service.get_certificate_template.js - * region_tag:privateca_v1_generated_CertificateAuthorityService_GetCertificateTemplate_async - */ - getCertificateTemplate( - request?: protos.google.cloud.security.privateca.v1.IGetCertificateTemplateRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.security.privateca.v1.ICertificateTemplate, - protos.google.cloud.security.privateca.v1.IGetCertificateTemplateRequest|undefined, {}|undefined - ]>; - getCertificateTemplate( - request: protos.google.cloud.security.privateca.v1.IGetCertificateTemplateRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.security.privateca.v1.ICertificateTemplate, - protos.google.cloud.security.privateca.v1.IGetCertificateTemplateRequest|null|undefined, - {}|null|undefined>): void; - getCertificateTemplate( - request: protos.google.cloud.security.privateca.v1.IGetCertificateTemplateRequest, - callback: Callback< - protos.google.cloud.security.privateca.v1.ICertificateTemplate, - protos.google.cloud.security.privateca.v1.IGetCertificateTemplateRequest|null|undefined, - {}|null|undefined>): void; - getCertificateTemplate( - request?: protos.google.cloud.security.privateca.v1.IGetCertificateTemplateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.security.privateca.v1.ICertificateTemplate, - protos.google.cloud.security.privateca.v1.IGetCertificateTemplateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.security.privateca.v1.ICertificateTemplate, - protos.google.cloud.security.privateca.v1.IGetCertificateTemplateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.security.privateca.v1.ICertificateTemplate, - protos.google.cloud.security.privateca.v1.IGetCertificateTemplateRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getCertificateTemplate(request, options, callback); - } - -/** - * Activate a {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthority} that is in state - * {@link google.cloud.security.privateca.v1.CertificateAuthority.State.AWAITING_USER_ACTIVATION|AWAITING_USER_ACTIVATION} - * and is of type {@link google.cloud.security.privateca.v1.CertificateAuthority.Type.SUBORDINATE|SUBORDINATE}. After - * the parent Certificate Authority signs a certificate signing request from - * {@link google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCertificateAuthorityCsr|FetchCertificateAuthorityCsr}, this method can complete the activation - * process. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name for this {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthority} in the - * format `projects/* /locations/* /caPools/* /certificateAuthorities/*`. - * @param {string} request.pemCaCertificate - * Required. The signed CA certificate issued from - * {@link google.cloud.security.privateca.v1.FetchCertificateAuthorityCsrResponse.pem_csr|FetchCertificateAuthorityCsrResponse.pem_csr}. - * @param {google.cloud.security.privateca.v1.SubordinateConfig} request.subordinateConfig - * Required. Must include information about the issuer of 'pem_ca_certificate', and any - * further issuers until the self-signed CA. - * @param {string} [request.requestId] - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/certificate_authority_service.activate_certificate_authority.js - * region_tag:privateca_v1_generated_CertificateAuthorityService_ActivateCertificateAuthority_async - */ - activateCertificateAuthority( - request?: protos.google.cloud.security.privateca.v1.IActivateCertificateAuthorityRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - activateCertificateAuthority( - request: protos.google.cloud.security.privateca.v1.IActivateCertificateAuthorityRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - activateCertificateAuthority( - request: protos.google.cloud.security.privateca.v1.IActivateCertificateAuthorityRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - activateCertificateAuthority( - request?: protos.google.cloud.security.privateca.v1.IActivateCertificateAuthorityRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.activateCertificateAuthority(request, options, callback); - } -/** - * Check the status of the long running operation returned by `activateCertificateAuthority()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/certificate_authority_service.activate_certificate_authority.js - * region_tag:privateca_v1_generated_CertificateAuthorityService_ActivateCertificateAuthority_async - */ - async checkActivateCertificateAuthorityProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.activateCertificateAuthority, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Create a new {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthority} 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 {@link google.cloud.security.privateca.v1.CaPool|CaPool} associated with the - * {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthorities}, in the format - * `projects/* /locations/* /caPools/*`. - * @param {string} request.certificateAuthorityId - * Required. It must be unique within a location and match the regular - * expression `[a-zA-Z0-9_-]{1,63}` - * @param {google.cloud.security.privateca.v1.CertificateAuthority} request.certificateAuthority - * Required. A {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthority} with initial field values. - * @param {string} [request.requestId] - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/certificate_authority_service.create_certificate_authority.js - * region_tag:privateca_v1_generated_CertificateAuthorityService_CreateCertificateAuthority_async - */ - createCertificateAuthority( - request?: protos.google.cloud.security.privateca.v1.ICreateCertificateAuthorityRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createCertificateAuthority( - request: protos.google.cloud.security.privateca.v1.ICreateCertificateAuthorityRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createCertificateAuthority( - request: protos.google.cloud.security.privateca.v1.ICreateCertificateAuthorityRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createCertificateAuthority( - request?: protos.google.cloud.security.privateca.v1.ICreateCertificateAuthorityRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createCertificateAuthority(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createCertificateAuthority()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/certificate_authority_service.create_certificate_authority.js - * region_tag:privateca_v1_generated_CertificateAuthorityService_CreateCertificateAuthority_async - */ - async checkCreateCertificateAuthorityProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createCertificateAuthority, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Disable a {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthority}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name for this {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthority} in the - * format `projects/* /locations/* /caPools/* /certificateAuthorities/*`. - * @param {string} [request.requestId] - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/certificate_authority_service.disable_certificate_authority.js - * region_tag:privateca_v1_generated_CertificateAuthorityService_DisableCertificateAuthority_async - */ - disableCertificateAuthority( - request?: protos.google.cloud.security.privateca.v1.IDisableCertificateAuthorityRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - disableCertificateAuthority( - request: protos.google.cloud.security.privateca.v1.IDisableCertificateAuthorityRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - disableCertificateAuthority( - request: protos.google.cloud.security.privateca.v1.IDisableCertificateAuthorityRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - disableCertificateAuthority( - request?: protos.google.cloud.security.privateca.v1.IDisableCertificateAuthorityRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.disableCertificateAuthority(request, options, callback); - } -/** - * Check the status of the long running operation returned by `disableCertificateAuthority()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/certificate_authority_service.disable_certificate_authority.js - * region_tag:privateca_v1_generated_CertificateAuthorityService_DisableCertificateAuthority_async - */ - async checkDisableCertificateAuthorityProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.disableCertificateAuthority, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Enable a {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthority}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name for this {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthority} in the - * format `projects/* /locations/* /caPools/* /certificateAuthorities/*`. - * @param {string} [request.requestId] - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/certificate_authority_service.enable_certificate_authority.js - * region_tag:privateca_v1_generated_CertificateAuthorityService_EnableCertificateAuthority_async - */ - enableCertificateAuthority( - request?: protos.google.cloud.security.privateca.v1.IEnableCertificateAuthorityRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - enableCertificateAuthority( - request: protos.google.cloud.security.privateca.v1.IEnableCertificateAuthorityRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - enableCertificateAuthority( - request: protos.google.cloud.security.privateca.v1.IEnableCertificateAuthorityRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - enableCertificateAuthority( - request?: protos.google.cloud.security.privateca.v1.IEnableCertificateAuthorityRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.enableCertificateAuthority(request, options, callback); - } -/** - * Check the status of the long running operation returned by `enableCertificateAuthority()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/certificate_authority_service.enable_certificate_authority.js - * region_tag:privateca_v1_generated_CertificateAuthorityService_EnableCertificateAuthority_async - */ - async checkEnableCertificateAuthorityProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.enableCertificateAuthority, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Undelete a {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthority} that has been deleted. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name for this {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthority} in the - * format `projects/* /locations/* /caPools/* /certificateAuthorities/*`. - * @param {string} [request.requestId] - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/certificate_authority_service.undelete_certificate_authority.js - * region_tag:privateca_v1_generated_CertificateAuthorityService_UndeleteCertificateAuthority_async - */ - undeleteCertificateAuthority( - request?: protos.google.cloud.security.privateca.v1.IUndeleteCertificateAuthorityRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - undeleteCertificateAuthority( - request: protos.google.cloud.security.privateca.v1.IUndeleteCertificateAuthorityRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - undeleteCertificateAuthority( - request: protos.google.cloud.security.privateca.v1.IUndeleteCertificateAuthorityRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - undeleteCertificateAuthority( - request?: protos.google.cloud.security.privateca.v1.IUndeleteCertificateAuthorityRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.undeleteCertificateAuthority(request, options, callback); - } -/** - * Check the status of the long running operation returned by `undeleteCertificateAuthority()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/certificate_authority_service.undelete_certificate_authority.js - * region_tag:privateca_v1_generated_CertificateAuthorityService_UndeleteCertificateAuthority_async - */ - async checkUndeleteCertificateAuthorityProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.undeleteCertificateAuthority, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Delete a {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthority}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name for this {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthority} in the - * format `projects/* /locations/* /caPools/* /certificateAuthorities/*`. - * @param {string} [request.requestId] - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {boolean} [request.ignoreActiveCertificates] - * Optional. This field allows the CA to be deleted even if the CA has - * active certs. Active certs include both unrevoked and unexpired certs. - * @param {boolean} [request.skipGracePeriod] - * Optional. If this flag is set, the Certificate Authority will be deleted as soon as - * possible without a 30-day grace period where undeletion would have been - * allowed. If you proceed, there will be no way to recover this CA. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/certificate_authority_service.delete_certificate_authority.js - * region_tag:privateca_v1_generated_CertificateAuthorityService_DeleteCertificateAuthority_async - */ - deleteCertificateAuthority( - request?: protos.google.cloud.security.privateca.v1.IDeleteCertificateAuthorityRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteCertificateAuthority( - request: protos.google.cloud.security.privateca.v1.IDeleteCertificateAuthorityRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteCertificateAuthority( - request: protos.google.cloud.security.privateca.v1.IDeleteCertificateAuthorityRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteCertificateAuthority( - request?: protos.google.cloud.security.privateca.v1.IDeleteCertificateAuthorityRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteCertificateAuthority(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteCertificateAuthority()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/certificate_authority_service.delete_certificate_authority.js - * region_tag:privateca_v1_generated_CertificateAuthorityService_DeleteCertificateAuthority_async - */ - async checkDeleteCertificateAuthorityProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.deleteCertificateAuthority, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Update a {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthority}. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.security.privateca.v1.CertificateAuthority} request.certificateAuthority - * Required. {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthority} with updated values. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. A list of fields to be updated in this request. - * @param {string} [request.requestId] - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/certificate_authority_service.update_certificate_authority.js - * region_tag:privateca_v1_generated_CertificateAuthorityService_UpdateCertificateAuthority_async - */ - updateCertificateAuthority( - request?: protos.google.cloud.security.privateca.v1.IUpdateCertificateAuthorityRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateCertificateAuthority( - request: protos.google.cloud.security.privateca.v1.IUpdateCertificateAuthorityRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateCertificateAuthority( - request: protos.google.cloud.security.privateca.v1.IUpdateCertificateAuthorityRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateCertificateAuthority( - request?: protos.google.cloud.security.privateca.v1.IUpdateCertificateAuthorityRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'certificate_authority.name': request.certificateAuthority!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateCertificateAuthority(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateCertificateAuthority()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/certificate_authority_service.update_certificate_authority.js - * region_tag:privateca_v1_generated_CertificateAuthorityService_UpdateCertificateAuthority_async - */ - async checkUpdateCertificateAuthorityProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.updateCertificateAuthority, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Create a {@link google.cloud.security.privateca.v1.CaPool|CaPool}. - * - * @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.security.privateca.v1.CaPool|CaPool}, in the format `projects/* /locations/*`. - * @param {string} request.caPoolId - * Required. It must be unique within a location and match the regular - * expression `[a-zA-Z0-9_-]{1,63}` - * @param {google.cloud.security.privateca.v1.CaPool} request.caPool - * Required. A {@link google.cloud.security.privateca.v1.CaPool|CaPool} with initial field values. - * @param {string} [request.requestId] - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/certificate_authority_service.create_ca_pool.js - * region_tag:privateca_v1_generated_CertificateAuthorityService_CreateCaPool_async - */ - createCaPool( - request?: protos.google.cloud.security.privateca.v1.ICreateCaPoolRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createCaPool( - request: protos.google.cloud.security.privateca.v1.ICreateCaPoolRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createCaPool( - request: protos.google.cloud.security.privateca.v1.ICreateCaPoolRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createCaPool( - request?: protos.google.cloud.security.privateca.v1.ICreateCaPoolRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createCaPool(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createCaPool()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/certificate_authority_service.create_ca_pool.js - * region_tag:privateca_v1_generated_CertificateAuthorityService_CreateCaPool_async - */ - async checkCreateCaPoolProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createCaPool, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Update a {@link google.cloud.security.privateca.v1.CaPool|CaPool}. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.security.privateca.v1.CaPool} request.caPool - * Required. {@link google.cloud.security.privateca.v1.CaPool|CaPool} with updated values. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. A list of fields to be updated in this request. - * @param {string} [request.requestId] - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/certificate_authority_service.update_ca_pool.js - * region_tag:privateca_v1_generated_CertificateAuthorityService_UpdateCaPool_async - */ - updateCaPool( - request?: protos.google.cloud.security.privateca.v1.IUpdateCaPoolRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateCaPool( - request: protos.google.cloud.security.privateca.v1.IUpdateCaPoolRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateCaPool( - request: protos.google.cloud.security.privateca.v1.IUpdateCaPoolRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateCaPool( - request?: protos.google.cloud.security.privateca.v1.IUpdateCaPoolRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'ca_pool.name': request.caPool!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateCaPool(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateCaPool()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/certificate_authority_service.update_ca_pool.js - * region_tag:privateca_v1_generated_CertificateAuthorityService_UpdateCaPool_async - */ - async checkUpdateCaPoolProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.updateCaPool, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Delete a {@link google.cloud.security.privateca.v1.CaPool|CaPool}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name for this {@link google.cloud.security.privateca.v1.CaPool|CaPool} in the - * format `projects/* /locations/* /caPools/*`. - * @param {string} [request.requestId] - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/certificate_authority_service.delete_ca_pool.js - * region_tag:privateca_v1_generated_CertificateAuthorityService_DeleteCaPool_async - */ - deleteCaPool( - request?: protos.google.cloud.security.privateca.v1.IDeleteCaPoolRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteCaPool( - request: protos.google.cloud.security.privateca.v1.IDeleteCaPoolRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteCaPool( - request: protos.google.cloud.security.privateca.v1.IDeleteCaPoolRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteCaPool( - request?: protos.google.cloud.security.privateca.v1.IDeleteCaPoolRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteCaPool(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteCaPool()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/certificate_authority_service.delete_ca_pool.js - * region_tag:privateca_v1_generated_CertificateAuthorityService_DeleteCaPool_async - */ - async checkDeleteCaPoolProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.deleteCaPool, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Update a {@link google.cloud.security.privateca.v1.CertificateRevocationList|CertificateRevocationList}. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.security.privateca.v1.CertificateRevocationList} request.certificateRevocationList - * Required. {@link google.cloud.security.privateca.v1.CertificateRevocationList|CertificateRevocationList} with updated values. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. A list of fields to be updated in this request. - * @param {string} [request.requestId] - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/certificate_authority_service.update_certificate_revocation_list.js - * region_tag:privateca_v1_generated_CertificateAuthorityService_UpdateCertificateRevocationList_async - */ - updateCertificateRevocationList( - request?: protos.google.cloud.security.privateca.v1.IUpdateCertificateRevocationListRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateCertificateRevocationList( - request: protos.google.cloud.security.privateca.v1.IUpdateCertificateRevocationListRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateCertificateRevocationList( - request: protos.google.cloud.security.privateca.v1.IUpdateCertificateRevocationListRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateCertificateRevocationList( - request?: protos.google.cloud.security.privateca.v1.IUpdateCertificateRevocationListRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'certificate_revocation_list.name': request.certificateRevocationList!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateCertificateRevocationList(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateCertificateRevocationList()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/certificate_authority_service.update_certificate_revocation_list.js - * region_tag:privateca_v1_generated_CertificateAuthorityService_UpdateCertificateRevocationList_async - */ - async checkUpdateCertificateRevocationListProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.updateCertificateRevocationList, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Create a new {@link google.cloud.security.privateca.v1.CertificateTemplate|CertificateTemplate} 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.security.privateca.v1.CertificateTemplate|CertificateTemplate}, in the format - * `projects/* /locations/*`. - * @param {string} request.certificateTemplateId - * Required. It must be unique within a location and match the regular - * expression `[a-zA-Z0-9_-]{1,63}` - * @param {google.cloud.security.privateca.v1.CertificateTemplate} request.certificateTemplate - * Required. A {@link google.cloud.security.privateca.v1.CertificateTemplate|CertificateTemplate} with initial field values. - * @param {string} [request.requestId] - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/certificate_authority_service.create_certificate_template.js - * region_tag:privateca_v1_generated_CertificateAuthorityService_CreateCertificateTemplate_async - */ - createCertificateTemplate( - request?: protos.google.cloud.security.privateca.v1.ICreateCertificateTemplateRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createCertificateTemplate( - request: protos.google.cloud.security.privateca.v1.ICreateCertificateTemplateRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createCertificateTemplate( - request: protos.google.cloud.security.privateca.v1.ICreateCertificateTemplateRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createCertificateTemplate( - request?: protos.google.cloud.security.privateca.v1.ICreateCertificateTemplateRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createCertificateTemplate(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createCertificateTemplate()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/certificate_authority_service.create_certificate_template.js - * region_tag:privateca_v1_generated_CertificateAuthorityService_CreateCertificateTemplate_async - */ - async checkCreateCertificateTemplateProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createCertificateTemplate, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * DeleteCertificateTemplate deletes a {@link google.cloud.security.privateca.v1.CertificateTemplate|CertificateTemplate}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name for this {@link google.cloud.security.privateca.v1.CertificateTemplate|CertificateTemplate} in the format - * `projects/* /locations/* /certificateTemplates/*`. - * @param {string} [request.requestId] - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/certificate_authority_service.delete_certificate_template.js - * region_tag:privateca_v1_generated_CertificateAuthorityService_DeleteCertificateTemplate_async - */ - deleteCertificateTemplate( - request?: protos.google.cloud.security.privateca.v1.IDeleteCertificateTemplateRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteCertificateTemplate( - request: protos.google.cloud.security.privateca.v1.IDeleteCertificateTemplateRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteCertificateTemplate( - request: protos.google.cloud.security.privateca.v1.IDeleteCertificateTemplateRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteCertificateTemplate( - request?: protos.google.cloud.security.privateca.v1.IDeleteCertificateTemplateRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteCertificateTemplate(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteCertificateTemplate()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/certificate_authority_service.delete_certificate_template.js - * region_tag:privateca_v1_generated_CertificateAuthorityService_DeleteCertificateTemplate_async - */ - async checkDeleteCertificateTemplateProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.deleteCertificateTemplate, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Update a {@link google.cloud.security.privateca.v1.CertificateTemplate|CertificateTemplate}. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.security.privateca.v1.CertificateTemplate} request.certificateTemplate - * Required. {@link google.cloud.security.privateca.v1.CertificateTemplate|CertificateTemplate} with updated values. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. A list of fields to be updated in this request. - * @param {string} [request.requestId] - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/certificate_authority_service.update_certificate_template.js - * region_tag:privateca_v1_generated_CertificateAuthorityService_UpdateCertificateTemplate_async - */ - updateCertificateTemplate( - request?: protos.google.cloud.security.privateca.v1.IUpdateCertificateTemplateRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateCertificateTemplate( - request: protos.google.cloud.security.privateca.v1.IUpdateCertificateTemplateRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateCertificateTemplate( - request: protos.google.cloud.security.privateca.v1.IUpdateCertificateTemplateRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateCertificateTemplate( - request?: protos.google.cloud.security.privateca.v1.IUpdateCertificateTemplateRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'certificate_template.name': request.certificateTemplate!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateCertificateTemplate(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateCertificateTemplate()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/certificate_authority_service.update_certificate_template.js - * region_tag:privateca_v1_generated_CertificateAuthorityService_UpdateCertificateTemplate_async - */ - async checkUpdateCertificateTemplateProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.updateCertificateTemplate, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists {@link google.cloud.security.privateca.v1.Certificate|Certificates}. - * - * @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.security.privateca.v1.Certificate|Certificates}, in the format - * `projects/* /locations/* /caPools/*`. - * @param {number} [request.pageSize] - * Optional. Limit on the number of - * {@link google.cloud.security.privateca.v1.Certificate|Certificates} to include in the - * response. Further {@link google.cloud.security.privateca.v1.Certificate|Certificates} can subsequently be obtained - * by including the - * {@link google.cloud.security.privateca.v1.ListCertificatesResponse.next_page_token|ListCertificatesResponse.next_page_token} in a subsequent - * request. If unspecified, the server will pick an appropriate default. - * @param {string} [request.pageToken] - * Optional. Pagination token, returned earlier via - * {@link google.cloud.security.privateca.v1.ListCertificatesResponse.next_page_token|ListCertificatesResponse.next_page_token}. - * @param {string} [request.filter] - * Optional. Only include resources that match the filter in the response. For details - * on supported filters and syntax, see [Certificates Filtering - * documentation](https://cloud.google.com/certificate-authority-service/docs/sorting-filtering-certificates#filtering_support). - * @param {string} [request.orderBy] - * Optional. Specify how the results should be sorted. For details on supported fields - * and syntax, see [Certificates Sorting - * documentation](https://cloud.google.com/certificate-authority-service/docs/sorting-filtering-certificates#sorting_support). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [Certificate]{@link google.cloud.security.privateca.v1.Certificate}. - * 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 `listCertificatesAsync()` - * 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. - */ - listCertificates( - request?: protos.google.cloud.security.privateca.v1.IListCertificatesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.security.privateca.v1.ICertificate[], - protos.google.cloud.security.privateca.v1.IListCertificatesRequest|null, - protos.google.cloud.security.privateca.v1.IListCertificatesResponse - ]>; - listCertificates( - request: protos.google.cloud.security.privateca.v1.IListCertificatesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.security.privateca.v1.IListCertificatesRequest, - protos.google.cloud.security.privateca.v1.IListCertificatesResponse|null|undefined, - protos.google.cloud.security.privateca.v1.ICertificate>): void; - listCertificates( - request: protos.google.cloud.security.privateca.v1.IListCertificatesRequest, - callback: PaginationCallback< - protos.google.cloud.security.privateca.v1.IListCertificatesRequest, - protos.google.cloud.security.privateca.v1.IListCertificatesResponse|null|undefined, - protos.google.cloud.security.privateca.v1.ICertificate>): void; - listCertificates( - request?: protos.google.cloud.security.privateca.v1.IListCertificatesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.security.privateca.v1.IListCertificatesRequest, - protos.google.cloud.security.privateca.v1.IListCertificatesResponse|null|undefined, - protos.google.cloud.security.privateca.v1.ICertificate>, - callback?: PaginationCallback< - protos.google.cloud.security.privateca.v1.IListCertificatesRequest, - protos.google.cloud.security.privateca.v1.IListCertificatesResponse|null|undefined, - protos.google.cloud.security.privateca.v1.ICertificate>): - Promise<[ - protos.google.cloud.security.privateca.v1.ICertificate[], - protos.google.cloud.security.privateca.v1.IListCertificatesRequest|null, - protos.google.cloud.security.privateca.v1.IListCertificatesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listCertificates(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.security.privateca.v1.Certificate|Certificates}, in the format - * `projects/* /locations/* /caPools/*`. - * @param {number} [request.pageSize] - * Optional. Limit on the number of - * {@link google.cloud.security.privateca.v1.Certificate|Certificates} to include in the - * response. Further {@link google.cloud.security.privateca.v1.Certificate|Certificates} can subsequently be obtained - * by including the - * {@link google.cloud.security.privateca.v1.ListCertificatesResponse.next_page_token|ListCertificatesResponse.next_page_token} in a subsequent - * request. If unspecified, the server will pick an appropriate default. - * @param {string} [request.pageToken] - * Optional. Pagination token, returned earlier via - * {@link google.cloud.security.privateca.v1.ListCertificatesResponse.next_page_token|ListCertificatesResponse.next_page_token}. - * @param {string} [request.filter] - * Optional. Only include resources that match the filter in the response. For details - * on supported filters and syntax, see [Certificates Filtering - * documentation](https://cloud.google.com/certificate-authority-service/docs/sorting-filtering-certificates#filtering_support). - * @param {string} [request.orderBy] - * Optional. Specify how the results should be sorted. For details on supported fields - * and syntax, see [Certificates Sorting - * documentation](https://cloud.google.com/certificate-authority-service/docs/sorting-filtering-certificates#sorting_support). - * @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 [Certificate]{@link google.cloud.security.privateca.v1.Certificate} 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 `listCertificatesAsync()` - * 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. - */ - listCertificatesStream( - request?: protos.google.cloud.security.privateca.v1.IListCertificatesRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listCertificates']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listCertificates.createStream( - this.innerApiCalls.listCertificates as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listCertificates`, 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.security.privateca.v1.Certificate|Certificates}, in the format - * `projects/* /locations/* /caPools/*`. - * @param {number} [request.pageSize] - * Optional. Limit on the number of - * {@link google.cloud.security.privateca.v1.Certificate|Certificates} to include in the - * response. Further {@link google.cloud.security.privateca.v1.Certificate|Certificates} can subsequently be obtained - * by including the - * {@link google.cloud.security.privateca.v1.ListCertificatesResponse.next_page_token|ListCertificatesResponse.next_page_token} in a subsequent - * request. If unspecified, the server will pick an appropriate default. - * @param {string} [request.pageToken] - * Optional. Pagination token, returned earlier via - * {@link google.cloud.security.privateca.v1.ListCertificatesResponse.next_page_token|ListCertificatesResponse.next_page_token}. - * @param {string} [request.filter] - * Optional. Only include resources that match the filter in the response. For details - * on supported filters and syntax, see [Certificates Filtering - * documentation](https://cloud.google.com/certificate-authority-service/docs/sorting-filtering-certificates#filtering_support). - * @param {string} [request.orderBy] - * Optional. Specify how the results should be sorted. For details on supported fields - * and syntax, see [Certificates Sorting - * documentation](https://cloud.google.com/certificate-authority-service/docs/sorting-filtering-certificates#sorting_support). - * @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 - * [Certificate]{@link google.cloud.security.privateca.v1.Certificate}. 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/certificate_authority_service.list_certificates.js - * region_tag:privateca_v1_generated_CertificateAuthorityService_ListCertificates_async - */ - listCertificatesAsync( - request?: protos.google.cloud.security.privateca.v1.IListCertificatesRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listCertificates']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listCertificates.asyncIterate( - this.innerApiCalls['listCertificates'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - /** - * Lists {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthorities}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the {@link google.cloud.security.privateca.v1.CaPool|CaPool} associated with the - * {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthorities}, in the format - * `projects/* /locations/* /caPools/*`. - * @param {number} [request.pageSize] - * Optional. Limit on the number of {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthorities} to - * include in the response. - * Further {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthorities} can subsequently be - * obtained by including the - * {@link google.cloud.security.privateca.v1.ListCertificateAuthoritiesResponse.next_page_token|ListCertificateAuthoritiesResponse.next_page_token} in a subsequent - * request. If unspecified, the server will pick an appropriate default. - * @param {string} [request.pageToken] - * Optional. Pagination token, returned earlier via - * {@link google.cloud.security.privateca.v1.ListCertificateAuthoritiesResponse.next_page_token|ListCertificateAuthoritiesResponse.next_page_token}. - * @param {string} [request.filter] - * Optional. Only include resources that match the filter in the response. - * @param {string} [request.orderBy] - * Optional. Specify how the results should be sorted. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [CertificateAuthority]{@link google.cloud.security.privateca.v1.CertificateAuthority}. - * 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 `listCertificateAuthoritiesAsync()` - * 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. - */ - listCertificateAuthorities( - request?: protos.google.cloud.security.privateca.v1.IListCertificateAuthoritiesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.security.privateca.v1.ICertificateAuthority[], - protos.google.cloud.security.privateca.v1.IListCertificateAuthoritiesRequest|null, - protos.google.cloud.security.privateca.v1.IListCertificateAuthoritiesResponse - ]>; - listCertificateAuthorities( - request: protos.google.cloud.security.privateca.v1.IListCertificateAuthoritiesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.security.privateca.v1.IListCertificateAuthoritiesRequest, - protos.google.cloud.security.privateca.v1.IListCertificateAuthoritiesResponse|null|undefined, - protos.google.cloud.security.privateca.v1.ICertificateAuthority>): void; - listCertificateAuthorities( - request: protos.google.cloud.security.privateca.v1.IListCertificateAuthoritiesRequest, - callback: PaginationCallback< - protos.google.cloud.security.privateca.v1.IListCertificateAuthoritiesRequest, - protos.google.cloud.security.privateca.v1.IListCertificateAuthoritiesResponse|null|undefined, - protos.google.cloud.security.privateca.v1.ICertificateAuthority>): void; - listCertificateAuthorities( - request?: protos.google.cloud.security.privateca.v1.IListCertificateAuthoritiesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.security.privateca.v1.IListCertificateAuthoritiesRequest, - protos.google.cloud.security.privateca.v1.IListCertificateAuthoritiesResponse|null|undefined, - protos.google.cloud.security.privateca.v1.ICertificateAuthority>, - callback?: PaginationCallback< - protos.google.cloud.security.privateca.v1.IListCertificateAuthoritiesRequest, - protos.google.cloud.security.privateca.v1.IListCertificateAuthoritiesResponse|null|undefined, - protos.google.cloud.security.privateca.v1.ICertificateAuthority>): - Promise<[ - protos.google.cloud.security.privateca.v1.ICertificateAuthority[], - protos.google.cloud.security.privateca.v1.IListCertificateAuthoritiesRequest|null, - protos.google.cloud.security.privateca.v1.IListCertificateAuthoritiesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listCertificateAuthorities(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.security.privateca.v1.CaPool|CaPool} associated with the - * {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthorities}, in the format - * `projects/* /locations/* /caPools/*`. - * @param {number} [request.pageSize] - * Optional. Limit on the number of {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthorities} to - * include in the response. - * Further {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthorities} can subsequently be - * obtained by including the - * {@link google.cloud.security.privateca.v1.ListCertificateAuthoritiesResponse.next_page_token|ListCertificateAuthoritiesResponse.next_page_token} in a subsequent - * request. If unspecified, the server will pick an appropriate default. - * @param {string} [request.pageToken] - * Optional. Pagination token, returned earlier via - * {@link google.cloud.security.privateca.v1.ListCertificateAuthoritiesResponse.next_page_token|ListCertificateAuthoritiesResponse.next_page_token}. - * @param {string} [request.filter] - * Optional. Only include resources that match the filter in the response. - * @param {string} [request.orderBy] - * Optional. Specify how the results should be sorted. - * @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 [CertificateAuthority]{@link google.cloud.security.privateca.v1.CertificateAuthority} 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 `listCertificateAuthoritiesAsync()` - * 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. - */ - listCertificateAuthoritiesStream( - request?: protos.google.cloud.security.privateca.v1.IListCertificateAuthoritiesRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listCertificateAuthorities']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listCertificateAuthorities.createStream( - this.innerApiCalls.listCertificateAuthorities as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listCertificateAuthorities`, 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.security.privateca.v1.CaPool|CaPool} associated with the - * {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthorities}, in the format - * `projects/* /locations/* /caPools/*`. - * @param {number} [request.pageSize] - * Optional. Limit on the number of {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthorities} to - * include in the response. - * Further {@link google.cloud.security.privateca.v1.CertificateAuthority|CertificateAuthorities} can subsequently be - * obtained by including the - * {@link google.cloud.security.privateca.v1.ListCertificateAuthoritiesResponse.next_page_token|ListCertificateAuthoritiesResponse.next_page_token} in a subsequent - * request. If unspecified, the server will pick an appropriate default. - * @param {string} [request.pageToken] - * Optional. Pagination token, returned earlier via - * {@link google.cloud.security.privateca.v1.ListCertificateAuthoritiesResponse.next_page_token|ListCertificateAuthoritiesResponse.next_page_token}. - * @param {string} [request.filter] - * Optional. Only include resources that match the filter in the response. - * @param {string} [request.orderBy] - * Optional. Specify how the results should be sorted. - * @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 - * [CertificateAuthority]{@link google.cloud.security.privateca.v1.CertificateAuthority}. 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/certificate_authority_service.list_certificate_authorities.js - * region_tag:privateca_v1_generated_CertificateAuthorityService_ListCertificateAuthorities_async - */ - listCertificateAuthoritiesAsync( - request?: protos.google.cloud.security.privateca.v1.IListCertificateAuthoritiesRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listCertificateAuthorities']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listCertificateAuthorities.asyncIterate( - this.innerApiCalls['listCertificateAuthorities'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - /** - * Lists {@link google.cloud.security.privateca.v1.CaPool|CaPools}. - * - * @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.security.privateca.v1.CaPool|CaPools}, in the format - * `projects/* /locations/*`. - * @param {number} [request.pageSize] - * Optional. Limit on the number of {@link google.cloud.security.privateca.v1.CaPool|CaPools} to - * include in the response. - * Further {@link google.cloud.security.privateca.v1.CaPool|CaPools} can subsequently be - * obtained by including the - * {@link google.cloud.security.privateca.v1.ListCaPoolsResponse.next_page_token|ListCaPoolsResponse.next_page_token} in a subsequent - * request. If unspecified, the server will pick an appropriate default. - * @param {string} [request.pageToken] - * Optional. Pagination token, returned earlier via - * {@link google.cloud.security.privateca.v1.ListCaPoolsResponse.next_page_token|ListCaPoolsResponse.next_page_token}. - * @param {string} [request.filter] - * Optional. Only include resources that match the filter in the response. - * @param {string} [request.orderBy] - * Optional. Specify how the results should be sorted. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [CaPool]{@link google.cloud.security.privateca.v1.CaPool}. - * 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 `listCaPoolsAsync()` - * 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. - */ - listCaPools( - request?: protos.google.cloud.security.privateca.v1.IListCaPoolsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.security.privateca.v1.ICaPool[], - protos.google.cloud.security.privateca.v1.IListCaPoolsRequest|null, - protos.google.cloud.security.privateca.v1.IListCaPoolsResponse - ]>; - listCaPools( - request: protos.google.cloud.security.privateca.v1.IListCaPoolsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.security.privateca.v1.IListCaPoolsRequest, - protos.google.cloud.security.privateca.v1.IListCaPoolsResponse|null|undefined, - protos.google.cloud.security.privateca.v1.ICaPool>): void; - listCaPools( - request: protos.google.cloud.security.privateca.v1.IListCaPoolsRequest, - callback: PaginationCallback< - protos.google.cloud.security.privateca.v1.IListCaPoolsRequest, - protos.google.cloud.security.privateca.v1.IListCaPoolsResponse|null|undefined, - protos.google.cloud.security.privateca.v1.ICaPool>): void; - listCaPools( - request?: protos.google.cloud.security.privateca.v1.IListCaPoolsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.security.privateca.v1.IListCaPoolsRequest, - protos.google.cloud.security.privateca.v1.IListCaPoolsResponse|null|undefined, - protos.google.cloud.security.privateca.v1.ICaPool>, - callback?: PaginationCallback< - protos.google.cloud.security.privateca.v1.IListCaPoolsRequest, - protos.google.cloud.security.privateca.v1.IListCaPoolsResponse|null|undefined, - protos.google.cloud.security.privateca.v1.ICaPool>): - Promise<[ - protos.google.cloud.security.privateca.v1.ICaPool[], - protos.google.cloud.security.privateca.v1.IListCaPoolsRequest|null, - protos.google.cloud.security.privateca.v1.IListCaPoolsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listCaPools(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.security.privateca.v1.CaPool|CaPools}, in the format - * `projects/* /locations/*`. - * @param {number} [request.pageSize] - * Optional. Limit on the number of {@link google.cloud.security.privateca.v1.CaPool|CaPools} to - * include in the response. - * Further {@link google.cloud.security.privateca.v1.CaPool|CaPools} can subsequently be - * obtained by including the - * {@link google.cloud.security.privateca.v1.ListCaPoolsResponse.next_page_token|ListCaPoolsResponse.next_page_token} in a subsequent - * request. If unspecified, the server will pick an appropriate default. - * @param {string} [request.pageToken] - * Optional. Pagination token, returned earlier via - * {@link google.cloud.security.privateca.v1.ListCaPoolsResponse.next_page_token|ListCaPoolsResponse.next_page_token}. - * @param {string} [request.filter] - * Optional. Only include resources that match the filter in the response. - * @param {string} [request.orderBy] - * Optional. Specify how the results should be sorted. - * @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 [CaPool]{@link google.cloud.security.privateca.v1.CaPool} 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 `listCaPoolsAsync()` - * 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. - */ - listCaPoolsStream( - request?: protos.google.cloud.security.privateca.v1.IListCaPoolsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listCaPools']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listCaPools.createStream( - this.innerApiCalls.listCaPools as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listCaPools`, 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.security.privateca.v1.CaPool|CaPools}, in the format - * `projects/* /locations/*`. - * @param {number} [request.pageSize] - * Optional. Limit on the number of {@link google.cloud.security.privateca.v1.CaPool|CaPools} to - * include in the response. - * Further {@link google.cloud.security.privateca.v1.CaPool|CaPools} can subsequently be - * obtained by including the - * {@link google.cloud.security.privateca.v1.ListCaPoolsResponse.next_page_token|ListCaPoolsResponse.next_page_token} in a subsequent - * request. If unspecified, the server will pick an appropriate default. - * @param {string} [request.pageToken] - * Optional. Pagination token, returned earlier via - * {@link google.cloud.security.privateca.v1.ListCaPoolsResponse.next_page_token|ListCaPoolsResponse.next_page_token}. - * @param {string} [request.filter] - * Optional. Only include resources that match the filter in the response. - * @param {string} [request.orderBy] - * Optional. Specify how the results should be sorted. - * @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 - * [CaPool]{@link google.cloud.security.privateca.v1.CaPool}. 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/certificate_authority_service.list_ca_pools.js - * region_tag:privateca_v1_generated_CertificateAuthorityService_ListCaPools_async - */ - listCaPoolsAsync( - request?: protos.google.cloud.security.privateca.v1.IListCaPoolsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listCaPools']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listCaPools.asyncIterate( - this.innerApiCalls['listCaPools'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - /** - * Lists {@link google.cloud.security.privateca.v1.CertificateRevocationList|CertificateRevocationLists}. - * - * @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.security.privateca.v1.CertificateRevocationList|CertificateRevocationLists}, in the format - * `projects/* /locations/* /caPools/* /certificateAuthorities/*`. - * @param {number} [request.pageSize] - * Optional. Limit on the number of - * {@link google.cloud.security.privateca.v1.CertificateRevocationList|CertificateRevocationLists} to include in the - * response. Further {@link google.cloud.security.privateca.v1.CertificateRevocationList|CertificateRevocationLists} - * can subsequently be obtained by including the - * {@link google.cloud.security.privateca.v1.ListCertificateRevocationListsResponse.next_page_token|ListCertificateRevocationListsResponse.next_page_token} in a subsequent - * request. If unspecified, the server will pick an appropriate default. - * @param {string} [request.pageToken] - * Optional. Pagination token, returned earlier via - * {@link google.cloud.security.privateca.v1.ListCertificateRevocationListsResponse.next_page_token|ListCertificateRevocationListsResponse.next_page_token}. - * @param {string} [request.filter] - * Optional. Only include resources that match the filter in the response. - * @param {string} [request.orderBy] - * Optional. Specify how the results should be sorted. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [CertificateRevocationList]{@link google.cloud.security.privateca.v1.CertificateRevocationList}. - * 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 `listCertificateRevocationListsAsync()` - * 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. - */ - listCertificateRevocationLists( - request?: protos.google.cloud.security.privateca.v1.IListCertificateRevocationListsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.security.privateca.v1.ICertificateRevocationList[], - protos.google.cloud.security.privateca.v1.IListCertificateRevocationListsRequest|null, - protos.google.cloud.security.privateca.v1.IListCertificateRevocationListsResponse - ]>; - listCertificateRevocationLists( - request: protos.google.cloud.security.privateca.v1.IListCertificateRevocationListsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.security.privateca.v1.IListCertificateRevocationListsRequest, - protos.google.cloud.security.privateca.v1.IListCertificateRevocationListsResponse|null|undefined, - protos.google.cloud.security.privateca.v1.ICertificateRevocationList>): void; - listCertificateRevocationLists( - request: protos.google.cloud.security.privateca.v1.IListCertificateRevocationListsRequest, - callback: PaginationCallback< - protos.google.cloud.security.privateca.v1.IListCertificateRevocationListsRequest, - protos.google.cloud.security.privateca.v1.IListCertificateRevocationListsResponse|null|undefined, - protos.google.cloud.security.privateca.v1.ICertificateRevocationList>): void; - listCertificateRevocationLists( - request?: protos.google.cloud.security.privateca.v1.IListCertificateRevocationListsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.security.privateca.v1.IListCertificateRevocationListsRequest, - protos.google.cloud.security.privateca.v1.IListCertificateRevocationListsResponse|null|undefined, - protos.google.cloud.security.privateca.v1.ICertificateRevocationList>, - callback?: PaginationCallback< - protos.google.cloud.security.privateca.v1.IListCertificateRevocationListsRequest, - protos.google.cloud.security.privateca.v1.IListCertificateRevocationListsResponse|null|undefined, - protos.google.cloud.security.privateca.v1.ICertificateRevocationList>): - Promise<[ - protos.google.cloud.security.privateca.v1.ICertificateRevocationList[], - protos.google.cloud.security.privateca.v1.IListCertificateRevocationListsRequest|null, - protos.google.cloud.security.privateca.v1.IListCertificateRevocationListsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listCertificateRevocationLists(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.security.privateca.v1.CertificateRevocationList|CertificateRevocationLists}, in the format - * `projects/* /locations/* /caPools/* /certificateAuthorities/*`. - * @param {number} [request.pageSize] - * Optional. Limit on the number of - * {@link google.cloud.security.privateca.v1.CertificateRevocationList|CertificateRevocationLists} to include in the - * response. Further {@link google.cloud.security.privateca.v1.CertificateRevocationList|CertificateRevocationLists} - * can subsequently be obtained by including the - * {@link google.cloud.security.privateca.v1.ListCertificateRevocationListsResponse.next_page_token|ListCertificateRevocationListsResponse.next_page_token} in a subsequent - * request. If unspecified, the server will pick an appropriate default. - * @param {string} [request.pageToken] - * Optional. Pagination token, returned earlier via - * {@link google.cloud.security.privateca.v1.ListCertificateRevocationListsResponse.next_page_token|ListCertificateRevocationListsResponse.next_page_token}. - * @param {string} [request.filter] - * Optional. Only include resources that match the filter in the response. - * @param {string} [request.orderBy] - * Optional. Specify how the results should be sorted. - * @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 [CertificateRevocationList]{@link google.cloud.security.privateca.v1.CertificateRevocationList} 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 `listCertificateRevocationListsAsync()` - * 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. - */ - listCertificateRevocationListsStream( - request?: protos.google.cloud.security.privateca.v1.IListCertificateRevocationListsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listCertificateRevocationLists']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listCertificateRevocationLists.createStream( - this.innerApiCalls.listCertificateRevocationLists as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listCertificateRevocationLists`, 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.security.privateca.v1.CertificateRevocationList|CertificateRevocationLists}, in the format - * `projects/* /locations/* /caPools/* /certificateAuthorities/*`. - * @param {number} [request.pageSize] - * Optional. Limit on the number of - * {@link google.cloud.security.privateca.v1.CertificateRevocationList|CertificateRevocationLists} to include in the - * response. Further {@link google.cloud.security.privateca.v1.CertificateRevocationList|CertificateRevocationLists} - * can subsequently be obtained by including the - * {@link google.cloud.security.privateca.v1.ListCertificateRevocationListsResponse.next_page_token|ListCertificateRevocationListsResponse.next_page_token} in a subsequent - * request. If unspecified, the server will pick an appropriate default. - * @param {string} [request.pageToken] - * Optional. Pagination token, returned earlier via - * {@link google.cloud.security.privateca.v1.ListCertificateRevocationListsResponse.next_page_token|ListCertificateRevocationListsResponse.next_page_token}. - * @param {string} [request.filter] - * Optional. Only include resources that match the filter in the response. - * @param {string} [request.orderBy] - * Optional. Specify how the results should be sorted. - * @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 - * [CertificateRevocationList]{@link google.cloud.security.privateca.v1.CertificateRevocationList}. 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/certificate_authority_service.list_certificate_revocation_lists.js - * region_tag:privateca_v1_generated_CertificateAuthorityService_ListCertificateRevocationLists_async - */ - listCertificateRevocationListsAsync( - request?: protos.google.cloud.security.privateca.v1.IListCertificateRevocationListsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listCertificateRevocationLists']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listCertificateRevocationLists.asyncIterate( - this.innerApiCalls['listCertificateRevocationLists'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - /** - * Lists {@link google.cloud.security.privateca.v1.CertificateTemplate|CertificateTemplates}. - * - * @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.security.privateca.v1.CertificateTemplate|CertificateTemplates}, in the format - * `projects/* /locations/*`. - * @param {number} [request.pageSize] - * Optional. Limit on the number of - * {@link google.cloud.security.privateca.v1.CertificateTemplate|CertificateTemplates} to include in the response. - * Further {@link google.cloud.security.privateca.v1.CertificateTemplate|CertificateTemplates} can subsequently be - * obtained by including the - * {@link google.cloud.security.privateca.v1.ListCertificateTemplatesResponse.next_page_token|ListCertificateTemplatesResponse.next_page_token} in a subsequent - * request. If unspecified, the server will pick an appropriate default. - * @param {string} [request.pageToken] - * Optional. Pagination token, returned earlier via - * {@link google.cloud.security.privateca.v1.ListCertificateTemplatesResponse.next_page_token|ListCertificateTemplatesResponse.next_page_token}. - * @param {string} [request.filter] - * Optional. Only include resources that match the filter in the response. - * @param {string} [request.orderBy] - * Optional. Specify how the results should be sorted. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [CertificateTemplate]{@link google.cloud.security.privateca.v1.CertificateTemplate}. - * 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 `listCertificateTemplatesAsync()` - * 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. - */ - listCertificateTemplates( - request?: protos.google.cloud.security.privateca.v1.IListCertificateTemplatesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.security.privateca.v1.ICertificateTemplate[], - protos.google.cloud.security.privateca.v1.IListCertificateTemplatesRequest|null, - protos.google.cloud.security.privateca.v1.IListCertificateTemplatesResponse - ]>; - listCertificateTemplates( - request: protos.google.cloud.security.privateca.v1.IListCertificateTemplatesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.security.privateca.v1.IListCertificateTemplatesRequest, - protos.google.cloud.security.privateca.v1.IListCertificateTemplatesResponse|null|undefined, - protos.google.cloud.security.privateca.v1.ICertificateTemplate>): void; - listCertificateTemplates( - request: protos.google.cloud.security.privateca.v1.IListCertificateTemplatesRequest, - callback: PaginationCallback< - protos.google.cloud.security.privateca.v1.IListCertificateTemplatesRequest, - protos.google.cloud.security.privateca.v1.IListCertificateTemplatesResponse|null|undefined, - protos.google.cloud.security.privateca.v1.ICertificateTemplate>): void; - listCertificateTemplates( - request?: protos.google.cloud.security.privateca.v1.IListCertificateTemplatesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.security.privateca.v1.IListCertificateTemplatesRequest, - protos.google.cloud.security.privateca.v1.IListCertificateTemplatesResponse|null|undefined, - protos.google.cloud.security.privateca.v1.ICertificateTemplate>, - callback?: PaginationCallback< - protos.google.cloud.security.privateca.v1.IListCertificateTemplatesRequest, - protos.google.cloud.security.privateca.v1.IListCertificateTemplatesResponse|null|undefined, - protos.google.cloud.security.privateca.v1.ICertificateTemplate>): - Promise<[ - protos.google.cloud.security.privateca.v1.ICertificateTemplate[], - protos.google.cloud.security.privateca.v1.IListCertificateTemplatesRequest|null, - protos.google.cloud.security.privateca.v1.IListCertificateTemplatesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listCertificateTemplates(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.security.privateca.v1.CertificateTemplate|CertificateTemplates}, in the format - * `projects/* /locations/*`. - * @param {number} [request.pageSize] - * Optional. Limit on the number of - * {@link google.cloud.security.privateca.v1.CertificateTemplate|CertificateTemplates} to include in the response. - * Further {@link google.cloud.security.privateca.v1.CertificateTemplate|CertificateTemplates} can subsequently be - * obtained by including the - * {@link google.cloud.security.privateca.v1.ListCertificateTemplatesResponse.next_page_token|ListCertificateTemplatesResponse.next_page_token} in a subsequent - * request. If unspecified, the server will pick an appropriate default. - * @param {string} [request.pageToken] - * Optional. Pagination token, returned earlier via - * {@link google.cloud.security.privateca.v1.ListCertificateTemplatesResponse.next_page_token|ListCertificateTemplatesResponse.next_page_token}. - * @param {string} [request.filter] - * Optional. Only include resources that match the filter in the response. - * @param {string} [request.orderBy] - * Optional. Specify how the results should be sorted. - * @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 [CertificateTemplate]{@link google.cloud.security.privateca.v1.CertificateTemplate} 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 `listCertificateTemplatesAsync()` - * 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. - */ - listCertificateTemplatesStream( - request?: protos.google.cloud.security.privateca.v1.IListCertificateTemplatesRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listCertificateTemplates']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listCertificateTemplates.createStream( - this.innerApiCalls.listCertificateTemplates as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listCertificateTemplates`, 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.security.privateca.v1.CertificateTemplate|CertificateTemplates}, in the format - * `projects/* /locations/*`. - * @param {number} [request.pageSize] - * Optional. Limit on the number of - * {@link google.cloud.security.privateca.v1.CertificateTemplate|CertificateTemplates} to include in the response. - * Further {@link google.cloud.security.privateca.v1.CertificateTemplate|CertificateTemplates} can subsequently be - * obtained by including the - * {@link google.cloud.security.privateca.v1.ListCertificateTemplatesResponse.next_page_token|ListCertificateTemplatesResponse.next_page_token} in a subsequent - * request. If unspecified, the server will pick an appropriate default. - * @param {string} [request.pageToken] - * Optional. Pagination token, returned earlier via - * {@link google.cloud.security.privateca.v1.ListCertificateTemplatesResponse.next_page_token|ListCertificateTemplatesResponse.next_page_token}. - * @param {string} [request.filter] - * Optional. Only include resources that match the filter in the response. - * @param {string} [request.orderBy] - * Optional. Specify how the results should be sorted. - * @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 - * [CertificateTemplate]{@link google.cloud.security.privateca.v1.CertificateTemplate}. 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/certificate_authority_service.list_certificate_templates.js - * region_tag:privateca_v1_generated_CertificateAuthorityService_ListCertificateTemplates_async - */ - listCertificateTemplatesAsync( - request?: protos.google.cloud.security.privateca.v1.IListCertificateTemplatesRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listCertificateTemplates']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listCertificateTemplates.asyncIterate( - this.innerApiCalls['listCertificateTemplates'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } -/** - * Gets the access control policy for a resource. Returns an empty policy - * if the resource exists and does not have a policy set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {Object} [request.options] - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * - * This object should have the same structure as [GetPolicyOptions]{@link google.iam.v1.GetPolicyOptions} - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [Policy]{@link google.iam.v1.Policy}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - getIamPolicy( - request: IamProtos.google.iam.v1.GetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise { - return this.iamClient.getIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - setIamPolicy( - request: IamProtos.google.iam.v1.SetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise { - return this.iamClient.setIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - */ - testIamPermissions( - request: IamProtos.google.iam.v1.TestIamPermissionsRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - > - ):Promise { - return this.iamClient.testIamPermissions(request, options, callback); - } - -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified caPool resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} ca_pool - * @returns {string} Resource name string. - */ - caPoolPath(project:string,location:string,caPool:string) { - return this.pathTemplates.caPoolPathTemplate.render({ - project: project, - location: location, - ca_pool: caPool, - }); - } - - /** - * Parse the project from CaPool resource. - * - * @param {string} caPoolName - * A fully-qualified path representing CaPool resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCaPoolName(caPoolName: string) { - return this.pathTemplates.caPoolPathTemplate.match(caPoolName).project; - } - - /** - * Parse the location from CaPool resource. - * - * @param {string} caPoolName - * A fully-qualified path representing CaPool resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCaPoolName(caPoolName: string) { - return this.pathTemplates.caPoolPathTemplate.match(caPoolName).location; - } - - /** - * Parse the ca_pool from CaPool resource. - * - * @param {string} caPoolName - * A fully-qualified path representing CaPool resource. - * @returns {string} A string representing the ca_pool. - */ - matchCaPoolFromCaPoolName(caPoolName: string) { - return this.pathTemplates.caPoolPathTemplate.match(caPoolName).ca_pool; - } - - /** - * Return a fully-qualified certificate resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} ca_pool - * @param {string} certificate - * @returns {string} Resource name string. - */ - certificatePath(project:string,location:string,caPool:string,certificate:string) { - return this.pathTemplates.certificatePathTemplate.render({ - project: project, - location: location, - ca_pool: caPool, - certificate: certificate, - }); - } - - /** - * Parse the project from Certificate resource. - * - * @param {string} certificateName - * A fully-qualified path representing Certificate resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCertificateName(certificateName: string) { - return this.pathTemplates.certificatePathTemplate.match(certificateName).project; - } - - /** - * Parse the location from Certificate resource. - * - * @param {string} certificateName - * A fully-qualified path representing Certificate resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCertificateName(certificateName: string) { - return this.pathTemplates.certificatePathTemplate.match(certificateName).location; - } - - /** - * Parse the ca_pool from Certificate resource. - * - * @param {string} certificateName - * A fully-qualified path representing Certificate resource. - * @returns {string} A string representing the ca_pool. - */ - matchCaPoolFromCertificateName(certificateName: string) { - return this.pathTemplates.certificatePathTemplate.match(certificateName).ca_pool; - } - - /** - * Parse the certificate from Certificate resource. - * - * @param {string} certificateName - * A fully-qualified path representing Certificate resource. - * @returns {string} A string representing the certificate. - */ - matchCertificateFromCertificateName(certificateName: string) { - return this.pathTemplates.certificatePathTemplate.match(certificateName).certificate; - } - - /** - * Return a fully-qualified certificateAuthority resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} ca_pool - * @param {string} certificate_authority - * @returns {string} Resource name string. - */ - certificateAuthorityPath(project:string,location:string,caPool:string,certificateAuthority:string) { - return this.pathTemplates.certificateAuthorityPathTemplate.render({ - project: project, - location: location, - ca_pool: caPool, - certificate_authority: certificateAuthority, - }); - } - - /** - * Parse the project from CertificateAuthority resource. - * - * @param {string} certificateAuthorityName - * A fully-qualified path representing CertificateAuthority resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCertificateAuthorityName(certificateAuthorityName: string) { - return this.pathTemplates.certificateAuthorityPathTemplate.match(certificateAuthorityName).project; - } - - /** - * Parse the location from CertificateAuthority resource. - * - * @param {string} certificateAuthorityName - * A fully-qualified path representing CertificateAuthority resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCertificateAuthorityName(certificateAuthorityName: string) { - return this.pathTemplates.certificateAuthorityPathTemplate.match(certificateAuthorityName).location; - } - - /** - * Parse the ca_pool from CertificateAuthority resource. - * - * @param {string} certificateAuthorityName - * A fully-qualified path representing CertificateAuthority resource. - * @returns {string} A string representing the ca_pool. - */ - matchCaPoolFromCertificateAuthorityName(certificateAuthorityName: string) { - return this.pathTemplates.certificateAuthorityPathTemplate.match(certificateAuthorityName).ca_pool; - } - - /** - * Parse the certificate_authority from CertificateAuthority resource. - * - * @param {string} certificateAuthorityName - * A fully-qualified path representing CertificateAuthority resource. - * @returns {string} A string representing the certificate_authority. - */ - matchCertificateAuthorityFromCertificateAuthorityName(certificateAuthorityName: string) { - return this.pathTemplates.certificateAuthorityPathTemplate.match(certificateAuthorityName).certificate_authority; - } - - /** - * Return a fully-qualified certificateRevocationList resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} ca_pool - * @param {string} certificate_authority - * @param {string} certificate_revocation_list - * @returns {string} Resource name string. - */ - certificateRevocationListPath(project:string,location:string,caPool:string,certificateAuthority:string,certificateRevocationList:string) { - return this.pathTemplates.certificateRevocationListPathTemplate.render({ - project: project, - location: location, - ca_pool: caPool, - certificate_authority: certificateAuthority, - certificate_revocation_list: certificateRevocationList, - }); - } - - /** - * Parse the project from CertificateRevocationList resource. - * - * @param {string} certificateRevocationListName - * A fully-qualified path representing CertificateRevocationList resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCertificateRevocationListName(certificateRevocationListName: string) { - return this.pathTemplates.certificateRevocationListPathTemplate.match(certificateRevocationListName).project; - } - - /** - * Parse the location from CertificateRevocationList resource. - * - * @param {string} certificateRevocationListName - * A fully-qualified path representing CertificateRevocationList resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCertificateRevocationListName(certificateRevocationListName: string) { - return this.pathTemplates.certificateRevocationListPathTemplate.match(certificateRevocationListName).location; - } - - /** - * Parse the ca_pool from CertificateRevocationList resource. - * - * @param {string} certificateRevocationListName - * A fully-qualified path representing CertificateRevocationList resource. - * @returns {string} A string representing the ca_pool. - */ - matchCaPoolFromCertificateRevocationListName(certificateRevocationListName: string) { - return this.pathTemplates.certificateRevocationListPathTemplate.match(certificateRevocationListName).ca_pool; - } - - /** - * Parse the certificate_authority from CertificateRevocationList resource. - * - * @param {string} certificateRevocationListName - * A fully-qualified path representing CertificateRevocationList resource. - * @returns {string} A string representing the certificate_authority. - */ - matchCertificateAuthorityFromCertificateRevocationListName(certificateRevocationListName: string) { - return this.pathTemplates.certificateRevocationListPathTemplate.match(certificateRevocationListName).certificate_authority; - } - - /** - * Parse the certificate_revocation_list from CertificateRevocationList resource. - * - * @param {string} certificateRevocationListName - * A fully-qualified path representing CertificateRevocationList resource. - * @returns {string} A string representing the certificate_revocation_list. - */ - matchCertificateRevocationListFromCertificateRevocationListName(certificateRevocationListName: string) { - return this.pathTemplates.certificateRevocationListPathTemplate.match(certificateRevocationListName).certificate_revocation_list; - } - - /** - * Return a fully-qualified certificateTemplate resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} certificate_template - * @returns {string} Resource name string. - */ - certificateTemplatePath(project:string,location:string,certificateTemplate:string) { - return this.pathTemplates.certificateTemplatePathTemplate.render({ - project: project, - location: location, - certificate_template: certificateTemplate, - }); - } - - /** - * Parse the project from CertificateTemplate resource. - * - * @param {string} certificateTemplateName - * A fully-qualified path representing CertificateTemplate resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCertificateTemplateName(certificateTemplateName: string) { - return this.pathTemplates.certificateTemplatePathTemplate.match(certificateTemplateName).project; - } - - /** - * Parse the location from CertificateTemplate resource. - * - * @param {string} certificateTemplateName - * A fully-qualified path representing CertificateTemplate resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCertificateTemplateName(certificateTemplateName: string) { - return this.pathTemplates.certificateTemplatePathTemplate.match(certificateTemplateName).location; - } - - /** - * Parse the certificate_template from CertificateTemplate resource. - * - * @param {string} certificateTemplateName - * A fully-qualified path representing CertificateTemplate resource. - * @returns {string} A string representing the certificate_template. - */ - matchCertificateTemplateFromCertificateTemplateName(certificateTemplateName: string) { - return this.pathTemplates.certificateTemplatePathTemplate.match(certificateTemplateName).certificate_template; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.certificateAuthorityServiceStub && !this._terminated) { - return this.certificateAuthorityServiceStub.then(stub => { - this._terminated = true; - stub.close(); - this.iamClient.close(); - this.locationsClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v1/src/v1/certificate_authority_service_client_config.json b/owl-bot-staging/v1/src/v1/certificate_authority_service_client_config.json deleted file mode 100644 index d7847b0..0000000 --- a/owl-bot-staging/v1/src/v1/certificate_authority_service_client_config.json +++ /dev/null @@ -1,176 +0,0 @@ -{ - "interfaces": { - "google.cloud.security.privateca.v1.CertificateAuthorityService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unknown_deadline_exceeded_unavailable": [ - "UNKNOWN", - "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": { - "CreateCertificate": { - "timeout_millis": 60000, - "retry_codes_name": "unknown_deadline_exceeded_unavailable", - "retry_params_name": "default" - }, - "GetCertificate": { - "timeout_millis": 60000, - "retry_codes_name": "unknown_deadline_exceeded_unavailable", - "retry_params_name": "default" - }, - "ListCertificates": { - "timeout_millis": 60000, - "retry_codes_name": "unknown_deadline_exceeded_unavailable", - "retry_params_name": "default" - }, - "RevokeCertificate": { - "timeout_millis": 60000, - "retry_codes_name": "unknown_deadline_exceeded_unavailable", - "retry_params_name": "default" - }, - "UpdateCertificate": { - "timeout_millis": 60000, - "retry_codes_name": "unknown_deadline_exceeded_unavailable", - "retry_params_name": "default" - }, - "ActivateCertificateAuthority": { - "timeout_millis": 60000, - "retry_codes_name": "unknown_deadline_exceeded_unavailable", - "retry_params_name": "default" - }, - "CreateCertificateAuthority": { - "timeout_millis": 60000, - "retry_codes_name": "unknown_deadline_exceeded_unavailable", - "retry_params_name": "default" - }, - "DisableCertificateAuthority": { - "timeout_millis": 60000, - "retry_codes_name": "unknown_deadline_exceeded_unavailable", - "retry_params_name": "default" - }, - "EnableCertificateAuthority": { - "timeout_millis": 60000, - "retry_codes_name": "unknown_deadline_exceeded_unavailable", - "retry_params_name": "default" - }, - "FetchCertificateAuthorityCsr": { - "timeout_millis": 60000, - "retry_codes_name": "unknown_deadline_exceeded_unavailable", - "retry_params_name": "default" - }, - "GetCertificateAuthority": { - "timeout_millis": 60000, - "retry_codes_name": "unknown_deadline_exceeded_unavailable", - "retry_params_name": "default" - }, - "ListCertificateAuthorities": { - "timeout_millis": 60000, - "retry_codes_name": "unknown_deadline_exceeded_unavailable", - "retry_params_name": "default" - }, - "UndeleteCertificateAuthority": { - "timeout_millis": 60000, - "retry_codes_name": "unknown_deadline_exceeded_unavailable", - "retry_params_name": "default" - }, - "DeleteCertificateAuthority": { - "timeout_millis": 60000, - "retry_codes_name": "unknown_deadline_exceeded_unavailable", - "retry_params_name": "default" - }, - "UpdateCertificateAuthority": { - "timeout_millis": 60000, - "retry_codes_name": "unknown_deadline_exceeded_unavailable", - "retry_params_name": "default" - }, - "CreateCaPool": { - "timeout_millis": 60000, - "retry_codes_name": "unknown_deadline_exceeded_unavailable", - "retry_params_name": "default" - }, - "UpdateCaPool": { - "timeout_millis": 60000, - "retry_codes_name": "unknown_deadline_exceeded_unavailable", - "retry_params_name": "default" - }, - "GetCaPool": { - "timeout_millis": 60000, - "retry_codes_name": "unknown_deadline_exceeded_unavailable", - "retry_params_name": "default" - }, - "ListCaPools": { - "timeout_millis": 60000, - "retry_codes_name": "unknown_deadline_exceeded_unavailable", - "retry_params_name": "default" - }, - "DeleteCaPool": { - "timeout_millis": 60000, - "retry_codes_name": "unknown_deadline_exceeded_unavailable", - "retry_params_name": "default" - }, - "FetchCaCerts": { - "timeout_millis": 60000, - "retry_codes_name": "unknown_deadline_exceeded_unavailable", - "retry_params_name": "default" - }, - "GetCertificateRevocationList": { - "timeout_millis": 60000, - "retry_codes_name": "unknown_deadline_exceeded_unavailable", - "retry_params_name": "default" - }, - "ListCertificateRevocationLists": { - "timeout_millis": 60000, - "retry_codes_name": "unknown_deadline_exceeded_unavailable", - "retry_params_name": "default" - }, - "UpdateCertificateRevocationList": { - "timeout_millis": 60000, - "retry_codes_name": "unknown_deadline_exceeded_unavailable", - "retry_params_name": "default" - }, - "CreateCertificateTemplate": { - "timeout_millis": 60000, - "retry_codes_name": "unknown_deadline_exceeded_unavailable", - "retry_params_name": "default" - }, - "DeleteCertificateTemplate": { - "timeout_millis": 60000, - "retry_codes_name": "unknown_deadline_exceeded_unavailable", - "retry_params_name": "default" - }, - "GetCertificateTemplate": { - "timeout_millis": 60000, - "retry_codes_name": "unknown_deadline_exceeded_unavailable", - "retry_params_name": "default" - }, - "ListCertificateTemplates": { - "timeout_millis": 60000, - "retry_codes_name": "unknown_deadline_exceeded_unavailable", - "retry_params_name": "default" - }, - "UpdateCertificateTemplate": { - "timeout_millis": 60000, - "retry_codes_name": "unknown_deadline_exceeded_unavailable", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v1/src/v1/certificate_authority_service_proto_list.json b/owl-bot-staging/v1/src/v1/certificate_authority_service_proto_list.json deleted file mode 100644 index ec340e4..0000000 --- a/owl-bot-staging/v1/src/v1/certificate_authority_service_proto_list.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "../../protos/google/cloud/security/privateca/v1/resources.proto", - "../../protos/google/cloud/security/privateca/v1/service.proto" -] diff --git a/owl-bot-staging/v1/src/v1/gapic_metadata.json b/owl-bot-staging/v1/src/v1/gapic_metadata.json deleted file mode 100644 index dc371ea..0000000 --- a/owl-bot-staging/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,333 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.security.privateca.v1", - "libraryPackage": "@google-cloud/security-private-ca", - "services": { - "CertificateAuthorityService": { - "clients": { - "grpc": { - "libraryClient": "CertificateAuthorityServiceClient", - "rpcs": { - "CreateCertificate": { - "methods": [ - "createCertificate" - ] - }, - "GetCertificate": { - "methods": [ - "getCertificate" - ] - }, - "RevokeCertificate": { - "methods": [ - "revokeCertificate" - ] - }, - "UpdateCertificate": { - "methods": [ - "updateCertificate" - ] - }, - "FetchCertificateAuthorityCsr": { - "methods": [ - "fetchCertificateAuthorityCsr" - ] - }, - "GetCertificateAuthority": { - "methods": [ - "getCertificateAuthority" - ] - }, - "GetCaPool": { - "methods": [ - "getCaPool" - ] - }, - "FetchCaCerts": { - "methods": [ - "fetchCaCerts" - ] - }, - "GetCertificateRevocationList": { - "methods": [ - "getCertificateRevocationList" - ] - }, - "GetCertificateTemplate": { - "methods": [ - "getCertificateTemplate" - ] - }, - "ActivateCertificateAuthority": { - "methods": [ - "activateCertificateAuthority" - ] - }, - "CreateCertificateAuthority": { - "methods": [ - "createCertificateAuthority" - ] - }, - "DisableCertificateAuthority": { - "methods": [ - "disableCertificateAuthority" - ] - }, - "EnableCertificateAuthority": { - "methods": [ - "enableCertificateAuthority" - ] - }, - "UndeleteCertificateAuthority": { - "methods": [ - "undeleteCertificateAuthority" - ] - }, - "DeleteCertificateAuthority": { - "methods": [ - "deleteCertificateAuthority" - ] - }, - "UpdateCertificateAuthority": { - "methods": [ - "updateCertificateAuthority" - ] - }, - "CreateCaPool": { - "methods": [ - "createCaPool" - ] - }, - "UpdateCaPool": { - "methods": [ - "updateCaPool" - ] - }, - "DeleteCaPool": { - "methods": [ - "deleteCaPool" - ] - }, - "UpdateCertificateRevocationList": { - "methods": [ - "updateCertificateRevocationList" - ] - }, - "CreateCertificateTemplate": { - "methods": [ - "createCertificateTemplate" - ] - }, - "DeleteCertificateTemplate": { - "methods": [ - "deleteCertificateTemplate" - ] - }, - "UpdateCertificateTemplate": { - "methods": [ - "updateCertificateTemplate" - ] - }, - "ListCertificates": { - "methods": [ - "listCertificates", - "listCertificatesStream", - "listCertificatesAsync" - ] - }, - "ListCertificateAuthorities": { - "methods": [ - "listCertificateAuthorities", - "listCertificateAuthoritiesStream", - "listCertificateAuthoritiesAsync" - ] - }, - "ListCaPools": { - "methods": [ - "listCaPools", - "listCaPoolsStream", - "listCaPoolsAsync" - ] - }, - "ListCertificateRevocationLists": { - "methods": [ - "listCertificateRevocationLists", - "listCertificateRevocationListsStream", - "listCertificateRevocationListsAsync" - ] - }, - "ListCertificateTemplates": { - "methods": [ - "listCertificateTemplates", - "listCertificateTemplatesStream", - "listCertificateTemplatesAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "CertificateAuthorityServiceClient", - "rpcs": { - "CreateCertificate": { - "methods": [ - "createCertificate" - ] - }, - "GetCertificate": { - "methods": [ - "getCertificate" - ] - }, - "RevokeCertificate": { - "methods": [ - "revokeCertificate" - ] - }, - "UpdateCertificate": { - "methods": [ - "updateCertificate" - ] - }, - "FetchCertificateAuthorityCsr": { - "methods": [ - "fetchCertificateAuthorityCsr" - ] - }, - "GetCertificateAuthority": { - "methods": [ - "getCertificateAuthority" - ] - }, - "GetCaPool": { - "methods": [ - "getCaPool" - ] - }, - "FetchCaCerts": { - "methods": [ - "fetchCaCerts" - ] - }, - "GetCertificateRevocationList": { - "methods": [ - "getCertificateRevocationList" - ] - }, - "GetCertificateTemplate": { - "methods": [ - "getCertificateTemplate" - ] - }, - "ActivateCertificateAuthority": { - "methods": [ - "activateCertificateAuthority" - ] - }, - "CreateCertificateAuthority": { - "methods": [ - "createCertificateAuthority" - ] - }, - "DisableCertificateAuthority": { - "methods": [ - "disableCertificateAuthority" - ] - }, - "EnableCertificateAuthority": { - "methods": [ - "enableCertificateAuthority" - ] - }, - "UndeleteCertificateAuthority": { - "methods": [ - "undeleteCertificateAuthority" - ] - }, - "DeleteCertificateAuthority": { - "methods": [ - "deleteCertificateAuthority" - ] - }, - "UpdateCertificateAuthority": { - "methods": [ - "updateCertificateAuthority" - ] - }, - "CreateCaPool": { - "methods": [ - "createCaPool" - ] - }, - "UpdateCaPool": { - "methods": [ - "updateCaPool" - ] - }, - "DeleteCaPool": { - "methods": [ - "deleteCaPool" - ] - }, - "UpdateCertificateRevocationList": { - "methods": [ - "updateCertificateRevocationList" - ] - }, - "CreateCertificateTemplate": { - "methods": [ - "createCertificateTemplate" - ] - }, - "DeleteCertificateTemplate": { - "methods": [ - "deleteCertificateTemplate" - ] - }, - "UpdateCertificateTemplate": { - "methods": [ - "updateCertificateTemplate" - ] - }, - "ListCertificates": { - "methods": [ - "listCertificates", - "listCertificatesStream", - "listCertificatesAsync" - ] - }, - "ListCertificateAuthorities": { - "methods": [ - "listCertificateAuthorities", - "listCertificateAuthoritiesStream", - "listCertificateAuthoritiesAsync" - ] - }, - "ListCaPools": { - "methods": [ - "listCaPools", - "listCaPoolsStream", - "listCaPoolsAsync" - ] - }, - "ListCertificateRevocationLists": { - "methods": [ - "listCertificateRevocationLists", - "listCertificateRevocationListsStream", - "listCertificateRevocationListsAsync" - ] - }, - "ListCertificateTemplates": { - "methods": [ - "listCertificateTemplates", - "listCertificateTemplatesStream", - "listCertificateTemplatesAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/v1/src/v1/index.ts b/owl-bot-staging/v1/src/v1/index.ts deleted file mode 100644 index 846c95b..0000000 --- a/owl-bot-staging/v1/src/v1/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -// 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 {CertificateAuthorityServiceClient} from './certificate_authority_service_client'; diff --git a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 8d0d0f8..0000000 --- a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,27 +0,0 @@ -// 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 privateca = require('@google-cloud/security-private-ca'); - -function main() { - const certificateAuthorityServiceClient = new privateca.CertificateAuthorityServiceClient(); -} - -main(); diff --git a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 445ab31..0000000 --- a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -// 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 {CertificateAuthorityServiceClient} from '@google-cloud/security-private-ca'; - -// check that the client class type name can be used -function doStuffWithCertificateAuthorityServiceClient(client: CertificateAuthorityServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const certificateAuthorityServiceClient = new CertificateAuthorityServiceClient(); - doStuffWithCertificateAuthorityServiceClient(certificateAuthorityServiceClient); -} - -main(); diff --git a/owl-bot-staging/v1/system-test/install.ts b/owl-bot-staging/v1/system-test/install.ts deleted file mode 100644 index 8ec4522..0000000 --- a/owl-bot-staging/v1/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// 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/owl-bot-staging/v1/test/gapic_certificate_authority_service_v1.ts b/owl-bot-staging/v1/test/gapic_certificate_authority_service_v1.ts deleted file mode 100644 index 7158747..0000000 --- a/owl-bot-staging/v1/test/gapic_certificate_authority_service_v1.ts +++ /dev/null @@ -1,5062 +0,0 @@ -// 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 certificateauthorityserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.CertificateAuthorityServiceClient', () => { - it('has servicePath', () => { - const servicePath = certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.certificateAuthorityServiceStub, undefined); - await client.initialize(); - assert(client.certificateAuthorityServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.certificateAuthorityServiceStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.certificateAuthorityServiceStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - 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 certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - 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('createCertificate', () => { - it('invokes createCertificate without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.CreateCertificateRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1.Certificate()); - client.innerApiCalls.createCertificate = stubSimpleCall(expectedResponse); - const [response] = await client.createCertificate(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createCertificate as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createCertificate without error using callback', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.CreateCertificateRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1.Certificate()); - client.innerApiCalls.createCertificate = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createCertificate( - request, - (err?: Error|null, result?: protos.google.cloud.security.privateca.v1.ICertificate|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createCertificate as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createCertificate with error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.CreateCertificateRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createCertificate = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createCertificate(request), expectedError); - assert((client.innerApiCalls.createCertificate as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createCertificate with closed client', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.CreateCertificateRequest()); - request.parent = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createCertificate(request), expectedError); - }); - }); - - describe('getCertificate', () => { - it('invokes getCertificate without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.GetCertificateRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1.Certificate()); - client.innerApiCalls.getCertificate = stubSimpleCall(expectedResponse); - const [response] = await client.getCertificate(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getCertificate as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getCertificate without error using callback', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.GetCertificateRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1.Certificate()); - client.innerApiCalls.getCertificate = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getCertificate( - request, - (err?: Error|null, result?: protos.google.cloud.security.privateca.v1.ICertificate|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getCertificate as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getCertificate with error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.GetCertificateRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getCertificate = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getCertificate(request), expectedError); - assert((client.innerApiCalls.getCertificate as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getCertificate with closed client', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.GetCertificateRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getCertificate(request), expectedError); - }); - }); - - describe('revokeCertificate', () => { - it('invokes revokeCertificate without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.RevokeCertificateRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1.Certificate()); - client.innerApiCalls.revokeCertificate = stubSimpleCall(expectedResponse); - const [response] = await client.revokeCertificate(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.revokeCertificate as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes revokeCertificate without error using callback', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.RevokeCertificateRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1.Certificate()); - client.innerApiCalls.revokeCertificate = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.revokeCertificate( - request, - (err?: Error|null, result?: protos.google.cloud.security.privateca.v1.ICertificate|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.revokeCertificate as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes revokeCertificate with error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.RevokeCertificateRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.revokeCertificate = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.revokeCertificate(request), expectedError); - assert((client.innerApiCalls.revokeCertificate as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes revokeCertificate with closed client', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.RevokeCertificateRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.revokeCertificate(request), expectedError); - }); - }); - - describe('updateCertificate', () => { - it('invokes updateCertificate without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.UpdateCertificateRequest()); - request.certificate = {}; - request.certificate.name = ''; - const expectedHeaderRequestParams = "certificate.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1.Certificate()); - client.innerApiCalls.updateCertificate = stubSimpleCall(expectedResponse); - const [response] = await client.updateCertificate(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateCertificate as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateCertificate without error using callback', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.UpdateCertificateRequest()); - request.certificate = {}; - request.certificate.name = ''; - const expectedHeaderRequestParams = "certificate.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1.Certificate()); - client.innerApiCalls.updateCertificate = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateCertificate( - request, - (err?: Error|null, result?: protos.google.cloud.security.privateca.v1.ICertificate|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateCertificate as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateCertificate with error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.UpdateCertificateRequest()); - request.certificate = {}; - request.certificate.name = ''; - const expectedHeaderRequestParams = "certificate.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateCertificate = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateCertificate(request), expectedError); - assert((client.innerApiCalls.updateCertificate as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateCertificate with closed client', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.UpdateCertificateRequest()); - request.certificate = {}; - request.certificate.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateCertificate(request), expectedError); - }); - }); - - describe('fetchCertificateAuthorityCsr', () => { - it('invokes fetchCertificateAuthorityCsr without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.FetchCertificateAuthorityCsrRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1.FetchCertificateAuthorityCsrResponse()); - client.innerApiCalls.fetchCertificateAuthorityCsr = stubSimpleCall(expectedResponse); - const [response] = await client.fetchCertificateAuthorityCsr(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.fetchCertificateAuthorityCsr as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes fetchCertificateAuthorityCsr without error using callback', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.FetchCertificateAuthorityCsrRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1.FetchCertificateAuthorityCsrResponse()); - client.innerApiCalls.fetchCertificateAuthorityCsr = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.fetchCertificateAuthorityCsr( - request, - (err?: Error|null, result?: protos.google.cloud.security.privateca.v1.IFetchCertificateAuthorityCsrResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.fetchCertificateAuthorityCsr as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes fetchCertificateAuthorityCsr with error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.FetchCertificateAuthorityCsrRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.fetchCertificateAuthorityCsr = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.fetchCertificateAuthorityCsr(request), expectedError); - assert((client.innerApiCalls.fetchCertificateAuthorityCsr as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes fetchCertificateAuthorityCsr with closed client', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.FetchCertificateAuthorityCsrRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.fetchCertificateAuthorityCsr(request), expectedError); - }); - }); - - describe('getCertificateAuthority', () => { - it('invokes getCertificateAuthority without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.GetCertificateAuthorityRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateAuthority()); - client.innerApiCalls.getCertificateAuthority = stubSimpleCall(expectedResponse); - const [response] = await client.getCertificateAuthority(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getCertificateAuthority without error using callback', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.GetCertificateAuthorityRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateAuthority()); - client.innerApiCalls.getCertificateAuthority = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getCertificateAuthority( - request, - (err?: Error|null, result?: protos.google.cloud.security.privateca.v1.ICertificateAuthority|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getCertificateAuthority with error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.GetCertificateAuthorityRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getCertificateAuthority = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getCertificateAuthority(request), expectedError); - assert((client.innerApiCalls.getCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getCertificateAuthority with closed client', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.GetCertificateAuthorityRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getCertificateAuthority(request), expectedError); - }); - }); - - describe('getCaPool', () => { - it('invokes getCaPool without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.GetCaPoolRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1.CaPool()); - client.innerApiCalls.getCaPool = stubSimpleCall(expectedResponse); - const [response] = await client.getCaPool(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getCaPool as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getCaPool without error using callback', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.GetCaPoolRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1.CaPool()); - client.innerApiCalls.getCaPool = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getCaPool( - request, - (err?: Error|null, result?: protos.google.cloud.security.privateca.v1.ICaPool|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getCaPool as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getCaPool with error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.GetCaPoolRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getCaPool = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getCaPool(request), expectedError); - assert((client.innerApiCalls.getCaPool as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getCaPool with closed client', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.GetCaPoolRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getCaPool(request), expectedError); - }); - }); - - describe('fetchCaCerts', () => { - it('invokes fetchCaCerts without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.FetchCaCertsRequest()); - request.caPool = ''; - const expectedHeaderRequestParams = "ca_pool="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1.FetchCaCertsResponse()); - client.innerApiCalls.fetchCaCerts = stubSimpleCall(expectedResponse); - const [response] = await client.fetchCaCerts(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.fetchCaCerts as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes fetchCaCerts without error using callback', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.FetchCaCertsRequest()); - request.caPool = ''; - const expectedHeaderRequestParams = "ca_pool="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1.FetchCaCertsResponse()); - client.innerApiCalls.fetchCaCerts = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.fetchCaCerts( - request, - (err?: Error|null, result?: protos.google.cloud.security.privateca.v1.IFetchCaCertsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.fetchCaCerts as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes fetchCaCerts with error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.FetchCaCertsRequest()); - request.caPool = ''; - const expectedHeaderRequestParams = "ca_pool="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.fetchCaCerts = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.fetchCaCerts(request), expectedError); - assert((client.innerApiCalls.fetchCaCerts as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes fetchCaCerts with closed client', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.FetchCaCertsRequest()); - request.caPool = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.fetchCaCerts(request), expectedError); - }); - }); - - describe('getCertificateRevocationList', () => { - it('invokes getCertificateRevocationList without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.GetCertificateRevocationListRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateRevocationList()); - client.innerApiCalls.getCertificateRevocationList = stubSimpleCall(expectedResponse); - const [response] = await client.getCertificateRevocationList(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getCertificateRevocationList as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getCertificateRevocationList without error using callback', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.GetCertificateRevocationListRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateRevocationList()); - client.innerApiCalls.getCertificateRevocationList = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getCertificateRevocationList( - request, - (err?: Error|null, result?: protos.google.cloud.security.privateca.v1.ICertificateRevocationList|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getCertificateRevocationList as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getCertificateRevocationList with error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.GetCertificateRevocationListRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getCertificateRevocationList = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getCertificateRevocationList(request), expectedError); - assert((client.innerApiCalls.getCertificateRevocationList as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getCertificateRevocationList with closed client', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.GetCertificateRevocationListRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getCertificateRevocationList(request), expectedError); - }); - }); - - describe('getCertificateTemplate', () => { - it('invokes getCertificateTemplate without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.GetCertificateTemplateRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateTemplate()); - client.innerApiCalls.getCertificateTemplate = stubSimpleCall(expectedResponse); - const [response] = await client.getCertificateTemplate(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getCertificateTemplate as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getCertificateTemplate without error using callback', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.GetCertificateTemplateRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateTemplate()); - client.innerApiCalls.getCertificateTemplate = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getCertificateTemplate( - request, - (err?: Error|null, result?: protos.google.cloud.security.privateca.v1.ICertificateTemplate|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getCertificateTemplate as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getCertificateTemplate with error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.GetCertificateTemplateRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getCertificateTemplate = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getCertificateTemplate(request), expectedError); - assert((client.innerApiCalls.getCertificateTemplate as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getCertificateTemplate with closed client', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.GetCertificateTemplateRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getCertificateTemplate(request), expectedError); - }); - }); - - describe('activateCertificateAuthority', () => { - it('invokes activateCertificateAuthority without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ActivateCertificateAuthorityRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.activateCertificateAuthority = stubLongRunningCall(expectedResponse); - const [operation] = await client.activateCertificateAuthority(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.activateCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes activateCertificateAuthority without error using callback', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ActivateCertificateAuthorityRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.activateCertificateAuthority = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.activateCertificateAuthority( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.activateCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes activateCertificateAuthority with call error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ActivateCertificateAuthorityRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.activateCertificateAuthority = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.activateCertificateAuthority(request), expectedError); - assert((client.innerApiCalls.activateCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes activateCertificateAuthority with LRO error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ActivateCertificateAuthorityRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.activateCertificateAuthority = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.activateCertificateAuthority(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.activateCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkActivateCertificateAuthorityProgress without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkActivateCertificateAuthorityProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkActivateCertificateAuthorityProgress with error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkActivateCertificateAuthorityProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createCertificateAuthority', () => { - it('invokes createCertificateAuthority without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.CreateCertificateAuthorityRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createCertificateAuthority = stubLongRunningCall(expectedResponse); - const [operation] = await client.createCertificateAuthority(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createCertificateAuthority without error using callback', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.CreateCertificateAuthorityRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createCertificateAuthority = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createCertificateAuthority( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createCertificateAuthority with call error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.CreateCertificateAuthorityRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createCertificateAuthority = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createCertificateAuthority(request), expectedError); - assert((client.innerApiCalls.createCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createCertificateAuthority with LRO error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.CreateCertificateAuthorityRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createCertificateAuthority = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createCertificateAuthority(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.createCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkCreateCertificateAuthorityProgress without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateCertificateAuthorityProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateCertificateAuthorityProgress with error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateCertificateAuthorityProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('disableCertificateAuthority', () => { - it('invokes disableCertificateAuthority without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.DisableCertificateAuthorityRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.disableCertificateAuthority = stubLongRunningCall(expectedResponse); - const [operation] = await client.disableCertificateAuthority(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.disableCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes disableCertificateAuthority without error using callback', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.DisableCertificateAuthorityRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.disableCertificateAuthority = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.disableCertificateAuthority( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.disableCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes disableCertificateAuthority with call error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.DisableCertificateAuthorityRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.disableCertificateAuthority = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.disableCertificateAuthority(request), expectedError); - assert((client.innerApiCalls.disableCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes disableCertificateAuthority with LRO error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.DisableCertificateAuthorityRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.disableCertificateAuthority = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.disableCertificateAuthority(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.disableCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkDisableCertificateAuthorityProgress without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDisableCertificateAuthorityProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDisableCertificateAuthorityProgress with error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDisableCertificateAuthorityProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('enableCertificateAuthority', () => { - it('invokes enableCertificateAuthority without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.EnableCertificateAuthorityRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.enableCertificateAuthority = stubLongRunningCall(expectedResponse); - const [operation] = await client.enableCertificateAuthority(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.enableCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes enableCertificateAuthority without error using callback', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.EnableCertificateAuthorityRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.enableCertificateAuthority = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.enableCertificateAuthority( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.enableCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes enableCertificateAuthority with call error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.EnableCertificateAuthorityRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.enableCertificateAuthority = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.enableCertificateAuthority(request), expectedError); - assert((client.innerApiCalls.enableCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes enableCertificateAuthority with LRO error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.EnableCertificateAuthorityRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.enableCertificateAuthority = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.enableCertificateAuthority(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.enableCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkEnableCertificateAuthorityProgress without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkEnableCertificateAuthorityProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkEnableCertificateAuthorityProgress with error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkEnableCertificateAuthorityProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('undeleteCertificateAuthority', () => { - it('invokes undeleteCertificateAuthority without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.UndeleteCertificateAuthorityRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.undeleteCertificateAuthority = stubLongRunningCall(expectedResponse); - const [operation] = await client.undeleteCertificateAuthority(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.undeleteCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes undeleteCertificateAuthority without error using callback', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.UndeleteCertificateAuthorityRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.undeleteCertificateAuthority = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.undeleteCertificateAuthority( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.undeleteCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes undeleteCertificateAuthority with call error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.UndeleteCertificateAuthorityRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.undeleteCertificateAuthority = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.undeleteCertificateAuthority(request), expectedError); - assert((client.innerApiCalls.undeleteCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes undeleteCertificateAuthority with LRO error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.UndeleteCertificateAuthorityRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.undeleteCertificateAuthority = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.undeleteCertificateAuthority(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.undeleteCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkUndeleteCertificateAuthorityProgress without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUndeleteCertificateAuthorityProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUndeleteCertificateAuthorityProgress with error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUndeleteCertificateAuthorityProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteCertificateAuthority', () => { - it('invokes deleteCertificateAuthority without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.DeleteCertificateAuthorityRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.deleteCertificateAuthority = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteCertificateAuthority(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteCertificateAuthority without error using callback', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.DeleteCertificateAuthorityRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.deleteCertificateAuthority = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteCertificateAuthority( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteCertificateAuthority with call error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.DeleteCertificateAuthorityRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteCertificateAuthority = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteCertificateAuthority(request), expectedError); - assert((client.innerApiCalls.deleteCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteCertificateAuthority with LRO error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.DeleteCertificateAuthorityRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteCertificateAuthority = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteCertificateAuthority(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.deleteCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkDeleteCertificateAuthorityProgress without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteCertificateAuthorityProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteCertificateAuthorityProgress with error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteCertificateAuthorityProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateCertificateAuthority', () => { - it('invokes updateCertificateAuthority without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.UpdateCertificateAuthorityRequest()); - request.certificateAuthority = {}; - request.certificateAuthority.name = ''; - const expectedHeaderRequestParams = "certificate_authority.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.updateCertificateAuthority = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateCertificateAuthority(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateCertificateAuthority without error using callback', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.UpdateCertificateAuthorityRequest()); - request.certificateAuthority = {}; - request.certificateAuthority.name = ''; - const expectedHeaderRequestParams = "certificate_authority.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.updateCertificateAuthority = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateCertificateAuthority( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateCertificateAuthority with call error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.UpdateCertificateAuthorityRequest()); - request.certificateAuthority = {}; - request.certificateAuthority.name = ''; - const expectedHeaderRequestParams = "certificate_authority.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateCertificateAuthority = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateCertificateAuthority(request), expectedError); - assert((client.innerApiCalls.updateCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateCertificateAuthority with LRO error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.UpdateCertificateAuthorityRequest()); - request.certificateAuthority = {}; - request.certificateAuthority.name = ''; - const expectedHeaderRequestParams = "certificate_authority.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateCertificateAuthority = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateCertificateAuthority(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.updateCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkUpdateCertificateAuthorityProgress without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateCertificateAuthorityProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateCertificateAuthorityProgress with error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateCertificateAuthorityProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createCaPool', () => { - it('invokes createCaPool without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.CreateCaPoolRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createCaPool = stubLongRunningCall(expectedResponse); - const [operation] = await client.createCaPool(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createCaPool as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createCaPool without error using callback', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.CreateCaPoolRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createCaPool = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createCaPool( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createCaPool as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createCaPool with call error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.CreateCaPoolRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createCaPool = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createCaPool(request), expectedError); - assert((client.innerApiCalls.createCaPool as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createCaPool with LRO error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.CreateCaPoolRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createCaPool = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createCaPool(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.createCaPool as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkCreateCaPoolProgress without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateCaPoolProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateCaPoolProgress with error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateCaPoolProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateCaPool', () => { - it('invokes updateCaPool without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.UpdateCaPoolRequest()); - request.caPool = {}; - request.caPool.name = ''; - const expectedHeaderRequestParams = "ca_pool.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.updateCaPool = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateCaPool(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateCaPool as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateCaPool without error using callback', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.UpdateCaPoolRequest()); - request.caPool = {}; - request.caPool.name = ''; - const expectedHeaderRequestParams = "ca_pool.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.updateCaPool = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateCaPool( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateCaPool as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateCaPool with call error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.UpdateCaPoolRequest()); - request.caPool = {}; - request.caPool.name = ''; - const expectedHeaderRequestParams = "ca_pool.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateCaPool = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateCaPool(request), expectedError); - assert((client.innerApiCalls.updateCaPool as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateCaPool with LRO error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.UpdateCaPoolRequest()); - request.caPool = {}; - request.caPool.name = ''; - const expectedHeaderRequestParams = "ca_pool.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateCaPool = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateCaPool(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.updateCaPool as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkUpdateCaPoolProgress without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateCaPoolProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateCaPoolProgress with error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateCaPoolProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteCaPool', () => { - it('invokes deleteCaPool without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.DeleteCaPoolRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.deleteCaPool = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteCaPool(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteCaPool as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteCaPool without error using callback', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.DeleteCaPoolRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.deleteCaPool = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteCaPool( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteCaPool as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteCaPool with call error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.DeleteCaPoolRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteCaPool = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteCaPool(request), expectedError); - assert((client.innerApiCalls.deleteCaPool as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteCaPool with LRO error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.DeleteCaPoolRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteCaPool = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteCaPool(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.deleteCaPool as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkDeleteCaPoolProgress without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteCaPoolProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteCaPoolProgress with error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteCaPoolProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateCertificateRevocationList', () => { - it('invokes updateCertificateRevocationList without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.UpdateCertificateRevocationListRequest()); - request.certificateRevocationList = {}; - request.certificateRevocationList.name = ''; - const expectedHeaderRequestParams = "certificate_revocation_list.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.updateCertificateRevocationList = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateCertificateRevocationList(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateCertificateRevocationList as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateCertificateRevocationList without error using callback', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.UpdateCertificateRevocationListRequest()); - request.certificateRevocationList = {}; - request.certificateRevocationList.name = ''; - const expectedHeaderRequestParams = "certificate_revocation_list.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.updateCertificateRevocationList = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateCertificateRevocationList( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateCertificateRevocationList as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateCertificateRevocationList with call error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.UpdateCertificateRevocationListRequest()); - request.certificateRevocationList = {}; - request.certificateRevocationList.name = ''; - const expectedHeaderRequestParams = "certificate_revocation_list.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateCertificateRevocationList = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateCertificateRevocationList(request), expectedError); - assert((client.innerApiCalls.updateCertificateRevocationList as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateCertificateRevocationList with LRO error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.UpdateCertificateRevocationListRequest()); - request.certificateRevocationList = {}; - request.certificateRevocationList.name = ''; - const expectedHeaderRequestParams = "certificate_revocation_list.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateCertificateRevocationList = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateCertificateRevocationList(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.updateCertificateRevocationList as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkUpdateCertificateRevocationListProgress without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateCertificateRevocationListProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateCertificateRevocationListProgress with error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateCertificateRevocationListProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createCertificateTemplate', () => { - it('invokes createCertificateTemplate without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.CreateCertificateTemplateRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createCertificateTemplate = stubLongRunningCall(expectedResponse); - const [operation] = await client.createCertificateTemplate(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createCertificateTemplate as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createCertificateTemplate without error using callback', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.CreateCertificateTemplateRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createCertificateTemplate = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createCertificateTemplate( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createCertificateTemplate as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createCertificateTemplate with call error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.CreateCertificateTemplateRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createCertificateTemplate = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createCertificateTemplate(request), expectedError); - assert((client.innerApiCalls.createCertificateTemplate as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createCertificateTemplate with LRO error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.CreateCertificateTemplateRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createCertificateTemplate = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createCertificateTemplate(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.createCertificateTemplate as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkCreateCertificateTemplateProgress without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateCertificateTemplateProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateCertificateTemplateProgress with error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateCertificateTemplateProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteCertificateTemplate', () => { - it('invokes deleteCertificateTemplate without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.DeleteCertificateTemplateRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.deleteCertificateTemplate = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteCertificateTemplate(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteCertificateTemplate as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteCertificateTemplate without error using callback', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.DeleteCertificateTemplateRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.deleteCertificateTemplate = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteCertificateTemplate( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteCertificateTemplate as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteCertificateTemplate with call error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.DeleteCertificateTemplateRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteCertificateTemplate = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteCertificateTemplate(request), expectedError); - assert((client.innerApiCalls.deleteCertificateTemplate as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteCertificateTemplate with LRO error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.DeleteCertificateTemplateRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteCertificateTemplate = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteCertificateTemplate(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.deleteCertificateTemplate as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkDeleteCertificateTemplateProgress without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteCertificateTemplateProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteCertificateTemplateProgress with error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteCertificateTemplateProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateCertificateTemplate', () => { - it('invokes updateCertificateTemplate without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.UpdateCertificateTemplateRequest()); - request.certificateTemplate = {}; - request.certificateTemplate.name = ''; - const expectedHeaderRequestParams = "certificate_template.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.updateCertificateTemplate = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateCertificateTemplate(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateCertificateTemplate as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateCertificateTemplate without error using callback', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.UpdateCertificateTemplateRequest()); - request.certificateTemplate = {}; - request.certificateTemplate.name = ''; - const expectedHeaderRequestParams = "certificate_template.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.updateCertificateTemplate = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateCertificateTemplate( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateCertificateTemplate as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateCertificateTemplate with call error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.UpdateCertificateTemplateRequest()); - request.certificateTemplate = {}; - request.certificateTemplate.name = ''; - const expectedHeaderRequestParams = "certificate_template.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateCertificateTemplate = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateCertificateTemplate(request), expectedError); - assert((client.innerApiCalls.updateCertificateTemplate as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateCertificateTemplate with LRO error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.UpdateCertificateTemplateRequest()); - request.certificateTemplate = {}; - request.certificateTemplate.name = ''; - const expectedHeaderRequestParams = "certificate_template.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateCertificateTemplate = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateCertificateTemplate(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.updateCertificateTemplate as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkUpdateCertificateTemplateProgress without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateCertificateTemplateProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateCertificateTemplateProgress with error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateCertificateTemplateProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listCertificates', () => { - it('invokes listCertificates without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificatesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.security.privateca.v1.Certificate()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1.Certificate()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1.Certificate()), - ]; - client.innerApiCalls.listCertificates = stubSimpleCall(expectedResponse); - const [response] = await client.listCertificates(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listCertificates as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listCertificates without error using callback', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificatesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.security.privateca.v1.Certificate()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1.Certificate()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1.Certificate()), - ]; - client.innerApiCalls.listCertificates = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listCertificates( - request, - (err?: Error|null, result?: protos.google.cloud.security.privateca.v1.ICertificate[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listCertificates as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listCertificates with error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificatesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listCertificates = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listCertificates(request), expectedError); - assert((client.innerApiCalls.listCertificates as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listCertificatesStream without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificatesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.security.privateca.v1.Certificate()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1.Certificate()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1.Certificate()), - ]; - client.descriptors.page.listCertificates.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listCertificatesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.security.privateca.v1.Certificate[] = []; - stream.on('data', (response: protos.google.cloud.security.privateca.v1.Certificate) => { - 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.listCertificates.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCertificates, request)); - assert.strictEqual( - (client.descriptors.page.listCertificates.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listCertificatesStream with error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificatesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listCertificates.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listCertificatesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.security.privateca.v1.Certificate[] = []; - stream.on('data', (response: protos.google.cloud.security.privateca.v1.Certificate) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listCertificates.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCertificates, request)); - assert.strictEqual( - (client.descriptors.page.listCertificates.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listCertificates without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificatesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.security.privateca.v1.Certificate()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1.Certificate()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1.Certificate()), - ]; - client.descriptors.page.listCertificates.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.security.privateca.v1.ICertificate[] = []; - const iterable = client.listCertificatesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listCertificates.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listCertificates.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listCertificates with error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificatesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listCertificates.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listCertificatesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.security.privateca.v1.ICertificate[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listCertificates.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listCertificates.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('listCertificateAuthorities', () => { - it('invokes listCertificateAuthorities without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificateAuthoritiesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateAuthority()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateAuthority()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateAuthority()), - ]; - client.innerApiCalls.listCertificateAuthorities = stubSimpleCall(expectedResponse); - const [response] = await client.listCertificateAuthorities(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listCertificateAuthorities as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listCertificateAuthorities without error using callback', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificateAuthoritiesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateAuthority()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateAuthority()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateAuthority()), - ]; - client.innerApiCalls.listCertificateAuthorities = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listCertificateAuthorities( - request, - (err?: Error|null, result?: protos.google.cloud.security.privateca.v1.ICertificateAuthority[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listCertificateAuthorities as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listCertificateAuthorities with error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificateAuthoritiesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listCertificateAuthorities = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listCertificateAuthorities(request), expectedError); - assert((client.innerApiCalls.listCertificateAuthorities as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listCertificateAuthoritiesStream without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificateAuthoritiesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateAuthority()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateAuthority()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateAuthority()), - ]; - client.descriptors.page.listCertificateAuthorities.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listCertificateAuthoritiesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.security.privateca.v1.CertificateAuthority[] = []; - stream.on('data', (response: protos.google.cloud.security.privateca.v1.CertificateAuthority) => { - 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.listCertificateAuthorities.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCertificateAuthorities, request)); - assert.strictEqual( - (client.descriptors.page.listCertificateAuthorities.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listCertificateAuthoritiesStream with error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificateAuthoritiesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listCertificateAuthorities.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listCertificateAuthoritiesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.security.privateca.v1.CertificateAuthority[] = []; - stream.on('data', (response: protos.google.cloud.security.privateca.v1.CertificateAuthority) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listCertificateAuthorities.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCertificateAuthorities, request)); - assert.strictEqual( - (client.descriptors.page.listCertificateAuthorities.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listCertificateAuthorities without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificateAuthoritiesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateAuthority()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateAuthority()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateAuthority()), - ]; - client.descriptors.page.listCertificateAuthorities.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.security.privateca.v1.ICertificateAuthority[] = []; - const iterable = client.listCertificateAuthoritiesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listCertificateAuthorities.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listCertificateAuthorities.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listCertificateAuthorities with error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificateAuthoritiesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listCertificateAuthorities.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listCertificateAuthoritiesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.security.privateca.v1.ICertificateAuthority[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listCertificateAuthorities.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listCertificateAuthorities.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('listCaPools', () => { - it('invokes listCaPools without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCaPoolsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.security.privateca.v1.CaPool()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1.CaPool()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1.CaPool()), - ]; - client.innerApiCalls.listCaPools = stubSimpleCall(expectedResponse); - const [response] = await client.listCaPools(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listCaPools as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listCaPools without error using callback', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCaPoolsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.security.privateca.v1.CaPool()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1.CaPool()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1.CaPool()), - ]; - client.innerApiCalls.listCaPools = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listCaPools( - request, - (err?: Error|null, result?: protos.google.cloud.security.privateca.v1.ICaPool[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listCaPools as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listCaPools with error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCaPoolsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listCaPools = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listCaPools(request), expectedError); - assert((client.innerApiCalls.listCaPools as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listCaPoolsStream without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCaPoolsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.security.privateca.v1.CaPool()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1.CaPool()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1.CaPool()), - ]; - client.descriptors.page.listCaPools.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listCaPoolsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.security.privateca.v1.CaPool[] = []; - stream.on('data', (response: protos.google.cloud.security.privateca.v1.CaPool) => { - 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.listCaPools.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCaPools, request)); - assert.strictEqual( - (client.descriptors.page.listCaPools.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listCaPoolsStream with error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCaPoolsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listCaPools.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listCaPoolsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.security.privateca.v1.CaPool[] = []; - stream.on('data', (response: protos.google.cloud.security.privateca.v1.CaPool) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listCaPools.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCaPools, request)); - assert.strictEqual( - (client.descriptors.page.listCaPools.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listCaPools without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCaPoolsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.security.privateca.v1.CaPool()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1.CaPool()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1.CaPool()), - ]; - client.descriptors.page.listCaPools.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.security.privateca.v1.ICaPool[] = []; - const iterable = client.listCaPoolsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listCaPools.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listCaPools.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listCaPools with error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCaPoolsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listCaPools.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listCaPoolsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.security.privateca.v1.ICaPool[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listCaPools.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listCaPools.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('listCertificateRevocationLists', () => { - it('invokes listCertificateRevocationLists without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificateRevocationListsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateRevocationList()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateRevocationList()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateRevocationList()), - ]; - client.innerApiCalls.listCertificateRevocationLists = stubSimpleCall(expectedResponse); - const [response] = await client.listCertificateRevocationLists(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listCertificateRevocationLists as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listCertificateRevocationLists without error using callback', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificateRevocationListsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateRevocationList()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateRevocationList()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateRevocationList()), - ]; - client.innerApiCalls.listCertificateRevocationLists = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listCertificateRevocationLists( - request, - (err?: Error|null, result?: protos.google.cloud.security.privateca.v1.ICertificateRevocationList[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listCertificateRevocationLists as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listCertificateRevocationLists with error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificateRevocationListsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listCertificateRevocationLists = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listCertificateRevocationLists(request), expectedError); - assert((client.innerApiCalls.listCertificateRevocationLists as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listCertificateRevocationListsStream without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificateRevocationListsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateRevocationList()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateRevocationList()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateRevocationList()), - ]; - client.descriptors.page.listCertificateRevocationLists.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listCertificateRevocationListsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.security.privateca.v1.CertificateRevocationList[] = []; - stream.on('data', (response: protos.google.cloud.security.privateca.v1.CertificateRevocationList) => { - 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.listCertificateRevocationLists.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCertificateRevocationLists, request)); - assert.strictEqual( - (client.descriptors.page.listCertificateRevocationLists.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listCertificateRevocationListsStream with error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificateRevocationListsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listCertificateRevocationLists.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listCertificateRevocationListsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.security.privateca.v1.CertificateRevocationList[] = []; - stream.on('data', (response: protos.google.cloud.security.privateca.v1.CertificateRevocationList) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listCertificateRevocationLists.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCertificateRevocationLists, request)); - assert.strictEqual( - (client.descriptors.page.listCertificateRevocationLists.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listCertificateRevocationLists without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificateRevocationListsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateRevocationList()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateRevocationList()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateRevocationList()), - ]; - client.descriptors.page.listCertificateRevocationLists.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.security.privateca.v1.ICertificateRevocationList[] = []; - const iterable = client.listCertificateRevocationListsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listCertificateRevocationLists.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listCertificateRevocationLists.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listCertificateRevocationLists with error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificateRevocationListsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listCertificateRevocationLists.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listCertificateRevocationListsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.security.privateca.v1.ICertificateRevocationList[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listCertificateRevocationLists.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listCertificateRevocationLists.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('listCertificateTemplates', () => { - it('invokes listCertificateTemplates without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificateTemplatesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateTemplate()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateTemplate()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateTemplate()), - ]; - client.innerApiCalls.listCertificateTemplates = stubSimpleCall(expectedResponse); - const [response] = await client.listCertificateTemplates(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listCertificateTemplates as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listCertificateTemplates without error using callback', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificateTemplatesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateTemplate()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateTemplate()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateTemplate()), - ]; - client.innerApiCalls.listCertificateTemplates = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listCertificateTemplates( - request, - (err?: Error|null, result?: protos.google.cloud.security.privateca.v1.ICertificateTemplate[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listCertificateTemplates as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listCertificateTemplates with error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificateTemplatesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listCertificateTemplates = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listCertificateTemplates(request), expectedError); - assert((client.innerApiCalls.listCertificateTemplates as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listCertificateTemplatesStream without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificateTemplatesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateTemplate()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateTemplate()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateTemplate()), - ]; - client.descriptors.page.listCertificateTemplates.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listCertificateTemplatesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.security.privateca.v1.CertificateTemplate[] = []; - stream.on('data', (response: protos.google.cloud.security.privateca.v1.CertificateTemplate) => { - 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.listCertificateTemplates.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCertificateTemplates, request)); - assert.strictEqual( - (client.descriptors.page.listCertificateTemplates.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listCertificateTemplatesStream with error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificateTemplatesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listCertificateTemplates.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listCertificateTemplatesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.security.privateca.v1.CertificateTemplate[] = []; - stream.on('data', (response: protos.google.cloud.security.privateca.v1.CertificateTemplate) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listCertificateTemplates.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCertificateTemplates, request)); - assert.strictEqual( - (client.descriptors.page.listCertificateTemplates.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listCertificateTemplates without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificateTemplatesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateTemplate()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateTemplate()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1.CertificateTemplate()), - ]; - client.descriptors.page.listCertificateTemplates.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.security.privateca.v1.ICertificateTemplate[] = []; - const iterable = client.listCertificateTemplatesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listCertificateTemplates.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listCertificateTemplates.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listCertificateTemplates with error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1.ListCertificateTemplatesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listCertificateTemplates.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listCertificateTemplatesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.security.privateca.v1.ICertificateTemplate[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listCertificateTemplates.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listCertificateTemplates.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - 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 certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - 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 certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - 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 certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - 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 certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - 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 certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - 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 certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - 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 certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - 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 certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - 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 certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - 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 certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - 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 certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - 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 certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - - describe('caPool', () => { - const fakePath = "/rendered/path/caPool"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - ca_pool: "caPoolValue", - }; - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.caPoolPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.caPoolPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('caPoolPath', () => { - const result = client.caPoolPath("projectValue", "locationValue", "caPoolValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.caPoolPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCaPoolName', () => { - const result = client.matchProjectFromCaPoolName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.caPoolPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCaPoolName', () => { - const result = client.matchLocationFromCaPoolName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.caPoolPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCaPoolFromCaPoolName', () => { - const result = client.matchCaPoolFromCaPoolName(fakePath); - assert.strictEqual(result, "caPoolValue"); - assert((client.pathTemplates.caPoolPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('certificate', () => { - const fakePath = "/rendered/path/certificate"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - ca_pool: "caPoolValue", - certificate: "certificateValue", - }; - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.certificatePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.certificatePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('certificatePath', () => { - const result = client.certificatePath("projectValue", "locationValue", "caPoolValue", "certificateValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.certificatePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCertificateName', () => { - const result = client.matchProjectFromCertificateName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.certificatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCertificateName', () => { - const result = client.matchLocationFromCertificateName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.certificatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCaPoolFromCertificateName', () => { - const result = client.matchCaPoolFromCertificateName(fakePath); - assert.strictEqual(result, "caPoolValue"); - assert((client.pathTemplates.certificatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCertificateFromCertificateName', () => { - const result = client.matchCertificateFromCertificateName(fakePath); - assert.strictEqual(result, "certificateValue"); - assert((client.pathTemplates.certificatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('certificateAuthority', () => { - const fakePath = "/rendered/path/certificateAuthority"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - ca_pool: "caPoolValue", - certificate_authority: "certificateAuthorityValue", - }; - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.certificateAuthorityPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.certificateAuthorityPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('certificateAuthorityPath', () => { - const result = client.certificateAuthorityPath("projectValue", "locationValue", "caPoolValue", "certificateAuthorityValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.certificateAuthorityPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCertificateAuthorityName', () => { - const result = client.matchProjectFromCertificateAuthorityName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.certificateAuthorityPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCertificateAuthorityName', () => { - const result = client.matchLocationFromCertificateAuthorityName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.certificateAuthorityPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCaPoolFromCertificateAuthorityName', () => { - const result = client.matchCaPoolFromCertificateAuthorityName(fakePath); - assert.strictEqual(result, "caPoolValue"); - assert((client.pathTemplates.certificateAuthorityPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCertificateAuthorityFromCertificateAuthorityName', () => { - const result = client.matchCertificateAuthorityFromCertificateAuthorityName(fakePath); - assert.strictEqual(result, "certificateAuthorityValue"); - assert((client.pathTemplates.certificateAuthorityPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('certificateRevocationList', () => { - const fakePath = "/rendered/path/certificateRevocationList"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - ca_pool: "caPoolValue", - certificate_authority: "certificateAuthorityValue", - certificate_revocation_list: "certificateRevocationListValue", - }; - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.certificateRevocationListPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.certificateRevocationListPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('certificateRevocationListPath', () => { - const result = client.certificateRevocationListPath("projectValue", "locationValue", "caPoolValue", "certificateAuthorityValue", "certificateRevocationListValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.certificateRevocationListPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCertificateRevocationListName', () => { - const result = client.matchProjectFromCertificateRevocationListName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.certificateRevocationListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCertificateRevocationListName', () => { - const result = client.matchLocationFromCertificateRevocationListName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.certificateRevocationListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCaPoolFromCertificateRevocationListName', () => { - const result = client.matchCaPoolFromCertificateRevocationListName(fakePath); - assert.strictEqual(result, "caPoolValue"); - assert((client.pathTemplates.certificateRevocationListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCertificateAuthorityFromCertificateRevocationListName', () => { - const result = client.matchCertificateAuthorityFromCertificateRevocationListName(fakePath); - assert.strictEqual(result, "certificateAuthorityValue"); - assert((client.pathTemplates.certificateRevocationListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCertificateRevocationListFromCertificateRevocationListName', () => { - const result = client.matchCertificateRevocationListFromCertificateRevocationListName(fakePath); - assert.strictEqual(result, "certificateRevocationListValue"); - assert((client.pathTemplates.certificateRevocationListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('certificateTemplate', () => { - const fakePath = "/rendered/path/certificateTemplate"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - certificate_template: "certificateTemplateValue", - }; - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.certificateTemplatePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.certificateTemplatePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('certificateTemplatePath', () => { - const result = client.certificateTemplatePath("projectValue", "locationValue", "certificateTemplateValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.certificateTemplatePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCertificateTemplateName', () => { - const result = client.matchProjectFromCertificateTemplateName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.certificateTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCertificateTemplateName', () => { - const result = client.matchLocationFromCertificateTemplateName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.certificateTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCertificateTemplateFromCertificateTemplateName', () => { - const result = client.matchCertificateTemplateFromCertificateTemplateName(fakePath); - assert.strictEqual(result, "certificateTemplateValue"); - assert((client.pathTemplates.certificateTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new certificateauthorityserviceModule.v1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/v1/tsconfig.json b/owl-bot-staging/v1/tsconfig.json deleted file mode 100644 index c78f1c8..0000000 --- a/owl-bot-staging/v1/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "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/owl-bot-staging/v1/webpack.config.js b/owl-bot-staging/v1/webpack.config.js deleted file mode 100644 index a187538..0000000 --- a/owl-bot-staging/v1/webpack.config.js +++ /dev/null @@ -1,64 +0,0 @@ -// 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: 'CertificateAuthorityService', - filename: './certificate-authority-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/owl-bot-staging/v1beta1/.eslintignore b/owl-bot-staging/v1beta1/.eslintignore deleted file mode 100644 index cfc348e..0000000 --- a/owl-bot-staging/v1beta1/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/owl-bot-staging/v1beta1/.eslintrc.json b/owl-bot-staging/v1beta1/.eslintrc.json deleted file mode 100644 index 7821534..0000000 --- a/owl-bot-staging/v1beta1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/v1beta1/.gitignore b/owl-bot-staging/v1beta1/.gitignore deleted file mode 100644 index 5d32b23..0000000 --- a/owl-bot-staging/v1beta1/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -**/*.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/owl-bot-staging/v1beta1/.jsdoc.js b/owl-bot-staging/v1beta1/.jsdoc.js deleted file mode 100644 index 8ee4107..0000000 --- a/owl-bot-staging/v1beta1/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// 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/security-private-ca', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/v1beta1/.mocharc.js b/owl-bot-staging/v1beta1/.mocharc.js deleted file mode 100644 index 481c522..0000000 --- a/owl-bot-staging/v1beta1/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// 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. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/owl-bot-staging/v1beta1/.prettierrc.js b/owl-bot-staging/v1beta1/.prettierrc.js deleted file mode 100644 index 494e147..0000000 --- a/owl-bot-staging/v1beta1/.prettierrc.js +++ /dev/null @@ -1,22 +0,0 @@ -// 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. ** - - -module.exports = { - ...require('gts/.prettierrc.json') -} diff --git a/owl-bot-staging/v1beta1/README.md b/owl-bot-staging/v1beta1/README.md deleted file mode 100644 index c74f8ea..0000000 --- a/owl-bot-staging/v1beta1/README.md +++ /dev/null @@ -1 +0,0 @@ -Privateca: Nodejs Client diff --git a/owl-bot-staging/v1beta1/linkinator.config.json b/owl-bot-staging/v1beta1/linkinator.config.json deleted file mode 100644 index befd23c..0000000 --- a/owl-bot-staging/v1beta1/linkinator.config.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "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/owl-bot-staging/v1beta1/package.json b/owl-bot-staging/v1beta1/package.json deleted file mode 100644 index 541fa74..0000000 --- a/owl-bot-staging/v1beta1/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "@google-cloud/security-private-ca", - "version": "0.1.0", - "description": "Privateca client for Node.js", - "repository": "googleapis/nodejs-privateca", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "build/src/index.js", - "files": [ - "build/src", - "build/protos" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google privateca", - "privateca", - "certificate authority service" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^3.1.1" - }, - "devDependencies": { - "@types/mocha": "^9.1.0", - "@types/node": "^16.0.0", - "@types/sinon": "^10.0.8", - "c8": "^7.11.0", - "gts": "^3.1.0", - "jsdoc": "^3.6.7", - "jsdoc-fresh": "^1.1.1", - "jsdoc-region-tag": "^1.3.1", - "linkinator": "^3.0.0", - "mocha": "^9.1.4", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^13.0.0", - "ts-loader": "^9.2.6", - "typescript": "^4.5.5", - "webpack": "^5.67.0", - "webpack-cli": "^4.9.1" - }, - "engines": { - "node": ">=v12" - } -} diff --git a/owl-bot-staging/v1beta1/protos/google/cloud/security/privateca/v1beta1/resources.proto b/owl-bot-staging/v1beta1/protos/google/cloud/security/privateca/v1beta1/resources.proto deleted file mode 100644 index f2bf7de..0000000 --- a/owl-bot-staging/v1beta1/protos/google/cloud/security/privateca/v1beta1/resources.proto +++ /dev/null @@ -1,903 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.security.privateca.v1beta1; - -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"; -import "google/api/annotations.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Security.PrivateCA.V1Beta1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/security/privateca/v1beta1;privateca"; -option java_multiple_files = true; -option java_outer_classname = "PrivateCaResourcesProto"; -option java_package = "com.google.cloud.security.privateca.v1beta1"; -option php_namespace = "Google\\Cloud\\Security\\PrivateCA\\V1beta1"; -option ruby_package = "Google::Cloud::Security::PrivateCA::V1beta1"; - -// A [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] represents an individual Certificate Authority. -// A [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] can be used to create [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. -message CertificateAuthority { - option (google.api.resource) = { - type: "privateca.googleapis.com/CertificateAuthority" - pattern: "projects/{project}/locations/{location}/certificateAuthorities/{certificate_authority}" - }; - - // Options that affect all certificates issued by a [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - message IssuingOptions { - // Required. When true, includes a URL to the issuing CA certificate in the - // "authority information access" X.509 extension. - bool include_ca_cert_url = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. When true, includes a URL to the CRL corresponding to certificates - // issued from a [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - // CRLs will expire 7 days from their creation. However, we will rebuild - // daily. CRLs are also rebuilt shortly after a certificate is revoked. - bool include_crl_access_url = 2 [(google.api.field_behavior) = REQUIRED]; - } - - // The issuing policy for a [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - // [Certificates][google.cloud.security.privateca.v1beta1.Certificate] will not be successfully issued from this - // [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] if they violate the policy. - message CertificateAuthorityPolicy { - message AllowedConfigList { - // Required. All [Certificates][google.cloud.security.privateca.v1beta1.Certificate] issued by the [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - // must match at least one listed [ReusableConfigWrapper][google.cloud.security.privateca.v1beta1.ReusableConfigWrapper]. If a - // [ReusableConfigWrapper][google.cloud.security.privateca.v1beta1.ReusableConfigWrapper] has an empty field, any value will be - // allowed for that field. - repeated ReusableConfigWrapper allowed_config_values = 1 [(google.api.field_behavior) = REQUIRED]; - } - - // [AllowedSubjectAltNames][google.cloud.security.privateca.v1beta1.CertificateAuthority.CertificateAuthorityPolicy.AllowedSubjectAltNames] specifies the allowed values for - // [SubjectAltNames][google.cloud.security.privateca.v1beta1.SubjectAltNames] by the [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] when issuing - // [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. - message AllowedSubjectAltNames { - // Optional. Contains valid, fully-qualified host names. Glob patterns are also - // supported. To allow an explicit wildcard certificate, escape with - // backlash (i.e. `\*`). - // E.g. for globbed entries: `*bar.com` will allow `foo.bar.com`, but not - // `*.bar.com`, unless the [allow_globbing_dns_wildcards][google.cloud.security.privateca.v1beta1.CertificateAuthority.CertificateAuthorityPolicy.AllowedSubjectAltNames.allow_globbing_dns_wildcards] field is set. - // E.g. for wildcard entries: `\*.bar.com` will allow `*.bar.com`, but not - // `foo.bar.com`. - repeated string allowed_dns_names = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Contains valid RFC 3986 URIs. Glob patterns are also supported. To - // match across path seperators (i.e. '/') use the double star glob - // pattern (i.e. '**'). - repeated string allowed_uris = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Contains valid RFC 2822 E-mail addresses. Glob patterns are also - // supported. - repeated string allowed_email_addresses = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Contains valid 32-bit IPv4 addresses and subnet ranges or RFC 4291 IPv6 - // addresses and subnet ranges. Subnet ranges are specified using the - // '/' notation (e.g. 10.0.0.0/8, 2001:700:300:1800::/64). Glob patterns - // are supported only for ip address entries (i.e. not for subnet ranges). - repeated string allowed_ips = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies if glob patterns used for [allowed_dns_names][google.cloud.security.privateca.v1beta1.CertificateAuthority.CertificateAuthorityPolicy.AllowedSubjectAltNames.allowed_dns_names] allows - // wildcard certificates. - bool allow_globbing_dns_wildcards = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies if to allow custom X509Extension values. - bool allow_custom_sans = 6 [(google.api.field_behavior) = OPTIONAL]; - } - - // [IssuanceModes][google.cloud.security.privateca.v1beta1.CertificateAuthority.CertificateAuthorityPolicy.IssuanceModes] specifies the allowed ways in which - // [Certificates][google.cloud.security.privateca.v1beta1.Certificate] may be requested from this - // [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - message IssuanceModes { - // Required. When true, allows callers to create [Certificates][google.cloud.security.privateca.v1beta1.Certificate] by - // specifying a CSR. - bool allow_csr_based_issuance = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. When true, allows callers to create [Certificates][google.cloud.security.privateca.v1beta1.Certificate] by - // specifying a [CertificateConfig][google.cloud.security.privateca.v1beta1.CertificateConfig]. - bool allow_config_based_issuance = 2 [(google.api.field_behavior) = REQUIRED]; - } - - // Allowed configurations or a single configuration for all issued - // certificates. - oneof config_policy { - // Optional. All [Certificates][google.cloud.security.privateca.v1beta1.Certificate] issued by the [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - // must match at least one listed [ReusableConfigWrapper][google.cloud.security.privateca.v1beta1.ReusableConfigWrapper] in the list. - AllowedConfigList allowed_config_list = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. All [Certificates][google.cloud.security.privateca.v1beta1.Certificate] issued by the [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - // will use the provided configuration values, overwriting any requested - // configuration values. - ReusableConfigWrapper overwrite_config_values = 2 [(google.api.field_behavior) = OPTIONAL]; - } - - // Optional. If any [Subject][google.cloud.security.privateca.v1beta1.Subject] is specified here, then all - // [Certificates][google.cloud.security.privateca.v1beta1.Certificate] issued by the [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] must - // match at least one listed [Subject][google.cloud.security.privateca.v1beta1.Subject]. If a [Subject][google.cloud.security.privateca.v1beta1.Subject] has an empty - // field, any value will be allowed for that field. - repeated Subject allowed_locations_and_organizations = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If any value is specified here, then all - // [Certificates][google.cloud.security.privateca.v1beta1.Certificate] issued by the [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] must - // match at least one listed value. If no value is specified, all values - // will be allowed for this fied. Glob patterns are also supported. - repeated string allowed_common_names = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If a [AllowedSubjectAltNames][google.cloud.security.privateca.v1beta1.CertificateAuthority.CertificateAuthorityPolicy.AllowedSubjectAltNames] is specified here, then all - // [Certificates][google.cloud.security.privateca.v1beta1.Certificate] issued by the [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] must - // match [AllowedSubjectAltNames][google.cloud.security.privateca.v1beta1.CertificateAuthority.CertificateAuthorityPolicy.AllowedSubjectAltNames]. If no value or an empty value - // is specified, any value will be allowed for the [SubjectAltNames][google.cloud.security.privateca.v1beta1.SubjectAltNames] - // field. - AllowedSubjectAltNames allowed_sans = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The maximum lifetime allowed by the [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. Note that - // if the any part if the issuing chain expires before a [Certificate][google.cloud.security.privateca.v1beta1.Certificate]'s - // requested maximum_lifetime, the effective lifetime will be explicitly - // truncated. - google.protobuf.Duration maximum_lifetime = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If specified, then only methods allowed in the [IssuanceModes][google.cloud.security.privateca.v1beta1.CertificateAuthority.CertificateAuthorityPolicy.IssuanceModes] may be - // used to issue [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. - IssuanceModes allowed_issuance_modes = 8 [(google.api.field_behavior) = OPTIONAL]; - } - - // URLs where a [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] will publish content. - message AccessUrls { - // The URL where this [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]'s CA certificate is - // published. This will only be set for CAs that have been activated. - string ca_certificate_access_url = 1; - - // The URL where this [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]'s CRLs are published. This - // will only be set for CAs that have been activated. - string crl_access_url = 2; - } - - // A Cloud KMS key configuration that a [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] will use. - message KeyVersionSpec { - oneof KeyVersion { - // Required. The resource name for an existing Cloud KMS CryptoKeyVersion in the - // format - // `projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*`. - // This option enables full flexibility in the key's capabilities and - // properties. - string cloud_kms_key_version = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The algorithm to use for creating a managed Cloud KMS key for a for a - // simplified experience. All managed keys will be have their - // [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] as `HSM`. - SignHashAlgorithm algorithm = 2 [(google.api.field_behavior) = REQUIRED]; - } - } - - // The type of a [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority], indicating its issuing chain. - enum Type { - // Not specified. - TYPE_UNSPECIFIED = 0; - - // Self-signed CA. - SELF_SIGNED = 1; - - // Subordinate CA. Could be issued by a Private CA [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - // or an unmanaged CA. - SUBORDINATE = 2; - } - - // The tier of a [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority], indicating its supported - // functionality and/or billing SKU. - enum Tier { - // Not specified. - TIER_UNSPECIFIED = 0; - - // Enterprise tier. - ENTERPRISE = 1; - - // DevOps tier. - DEVOPS = 2; - } - - // The state of a [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority], indicating if it can be used. - enum State { - // Not specified. - STATE_UNSPECIFIED = 0; - - // Certificates can be issued from this CA. CRLs will be generated for this - // CA. - ENABLED = 1; - - // Certificates cannot be issued from this CA. CRLs will still be generated. - DISABLED = 2; - - // Certificates cannot be issued from this CA. CRLs will not be generated. - PENDING_ACTIVATION = 3; - - // Certificates cannot be issued from this CA. CRLs will not be generated. - PENDING_DELETION = 4; - } - - // The algorithm of a Cloud KMS CryptoKeyVersion of a - // [CryptoKey][google.cloud.kms.v1.CryptoKey] with the - // [CryptoKeyPurpose][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose] value - // `ASYMMETRIC_SIGN`. These values correspond to the - // [CryptoKeyVersionAlgorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm] - // values. For RSA signing algorithms, the PSS algorithms should be preferred, - // use PKCS1 algorithms if required for compatibility. For further - // recommandations, see - // https://cloud.google.com/kms/docs/algorithms#algorithm_recommendations. - enum SignHashAlgorithm { - // Not specified. - SIGN_HASH_ALGORITHM_UNSPECIFIED = 0; - - // maps to CryptoKeyVersionAlgorithm.RSA_SIGN_PSS_2048_SHA256 - RSA_PSS_2048_SHA256 = 1; - - // maps to CryptoKeyVersionAlgorithm. RSA_SIGN_PSS_3072_SHA256 - RSA_PSS_3072_SHA256 = 2; - - // maps to CryptoKeyVersionAlgorithm.RSA_SIGN_PSS_4096_SHA256 - RSA_PSS_4096_SHA256 = 3; - - // maps to CryptoKeyVersionAlgorithm.RSA_SIGN_PKCS1_2048_SHA256 - RSA_PKCS1_2048_SHA256 = 6; - - // maps to CryptoKeyVersionAlgorithm.RSA_SIGN_PKCS1_3072_SHA256 - RSA_PKCS1_3072_SHA256 = 7; - - // maps to CryptoKeyVersionAlgorithm.RSA_SIGN_PKCS1_4096_SHA256 - RSA_PKCS1_4096_SHA256 = 8; - - // maps to CryptoKeyVersionAlgorithm.EC_SIGN_P256_SHA256 - EC_P256_SHA256 = 4; - - // maps to CryptoKeyVersionAlgorithm.EC_SIGN_P384_SHA384 - EC_P384_SHA384 = 5; - } - - // Output only. The resource name for this [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] in the - // format `projects/*/locations/*/certificateAuthorities/*`. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Required. Immutable. The [Type][google.cloud.security.privateca.v1beta1.CertificateAuthority.Type] of this [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - Type type = 2 [ - (google.api.field_behavior) = REQUIRED, - (google.api.field_behavior) = IMMUTABLE - ]; - - // Required. Immutable. The [Tier][google.cloud.security.privateca.v1beta1.CertificateAuthority.Tier] of this [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - Tier tier = 3 [ - (google.api.field_behavior) = REQUIRED, - (google.api.field_behavior) = IMMUTABLE - ]; - - // Required. Immutable. The config used to create a self-signed X.509 certificate or CSR. - CertificateConfig config = 4 [ - (google.api.field_behavior) = REQUIRED, - (google.api.field_behavior) = IMMUTABLE - ]; - - // Required. The desired lifetime of the CA certificate. Used to create the - // "not_before_time" and "not_after_time" fields inside an X.509 - // certificate. - google.protobuf.Duration lifetime = 5 [(google.api.field_behavior) = REQUIRED]; - - // Required. Immutable. Used when issuing certificates for this [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. If this - // [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] is a self-signed CertificateAuthority, this key - // is also used to sign the self-signed CA certificate. Otherwise, it - // is used to sign a CSR. - KeyVersionSpec key_spec = 6 [ - (google.api.field_behavior) = REQUIRED, - (google.api.field_behavior) = IMMUTABLE - ]; - - // Optional. The [CertificateAuthorityPolicy][google.cloud.security.privateca.v1beta1.CertificateAuthority.CertificateAuthorityPolicy] to enforce when issuing - // [Certificates][google.cloud.security.privateca.v1beta1.Certificate] from this [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - CertificateAuthorityPolicy certificate_policy = 7 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The [IssuingOptions][google.cloud.security.privateca.v1beta1.CertificateAuthority.IssuingOptions] to follow when issuing [Certificates][google.cloud.security.privateca.v1beta1.Certificate] - // from this [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - IssuingOptions issuing_options = 8 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If this is a subordinate [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority], this field will be set - // with the subordinate configuration, which describes its issuers. This may - // be updated, but this [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] must continue to validate. - SubordinateConfig subordinate_config = 19 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The [State][google.cloud.security.privateca.v1beta1.CertificateAuthority.State] for this [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - State state = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. This [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]'s certificate chain, including the current - // [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]'s certificate. Ordered such that the root issuer - // is the final element (consistent with RFC 5246). For a self-signed CA, this - // will only list the current [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]'s certificate. - repeated string pem_ca_certificates = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A structured description of this [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]'s CA certificate - // and its issuers. Ordered as self-to-root. - repeated CertificateDescription ca_certificate_descriptions = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Immutable. The name of a Cloud Storage bucket where this [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] will - // publish content, such as the CA certificate and CRLs. This must be a bucket - // name, without any prefixes (such as `gs://`) or suffixes (such as - // `.googleapis.com`). For example, to use a bucket named `my-bucket`, you - // would simply specify `my-bucket`. If not specified, a managed bucket will - // be created. - string gcs_bucket = 13 [(google.api.field_behavior) = IMMUTABLE]; - - // Output only. URLs for accessing content published by this CA, such as the CA certificate - // and CRLs. - AccessUrls access_urls = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time at which this [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] was created. - google.protobuf.Timestamp create_time = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time at which this [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] was updated. - google.protobuf.Timestamp update_time = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time at which this [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] will be deleted, if - // scheduled for deletion. - google.protobuf.Timestamp delete_time = 17 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Labels with user-defined metadata. - map labels = 18 [(google.api.field_behavior) = OPTIONAL]; -} - -// A [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList] corresponds to a signed X.509 certificate -// Revocation List (CRL). A CRL contains the serial numbers of certificates that -// should no longer be trusted. -message CertificateRevocationList { - option (google.api.resource) = { - type: "privateca.googleapis.com/CertificateRevocationList" - pattern: "projects/{project}/locations/{location}/certificateAuthorities/{certificate_authority}/certificateRevocationLists/{certificate_revocation_list}" - }; - - // Describes a revoked [Certificate][google.cloud.security.privateca.v1beta1.Certificate]. - message RevokedCertificate { - // The resource path for the [Certificate][google.cloud.security.privateca.v1beta1.Certificate] in the format - // `projects/*/locations/*/certificateAuthorities/*/certificates/*`. - string certificate = 1; - - // The serial number of the [Certificate][google.cloud.security.privateca.v1beta1.Certificate]. - string hex_serial_number = 2; - - // The reason the [Certificate][google.cloud.security.privateca.v1beta1.Certificate] was revoked. - RevocationReason revocation_reason = 3; - } - - // The state of a [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList], indicating if it is current. - enum State { - // Not specified. - STATE_UNSPECIFIED = 0; - - // The [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList] is up to date. - ACTIVE = 1; - - // The [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList] is no longer current. - SUPERSEDED = 2; - } - - // Output only. The resource path for this [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList] in - // the format - // `projects/*/locations/*/certificateAuthorities/*/ - // certificateRevocationLists/*`. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The CRL sequence number that appears in pem_crl. - int64 sequence_number = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The revoked serial numbers that appear in pem_crl. - repeated RevokedCertificate revoked_certificates = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The PEM-encoded X.509 CRL. - string pem_crl = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The location where 'pem_crl' can be accessed. - string access_url = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The [State][google.cloud.security.privateca.v1beta1.CertificateRevocationList.State] for this [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList]. - State state = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time at which this [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList] was created. - google.protobuf.Timestamp create_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time at which this [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList] was updated. - google.protobuf.Timestamp update_time = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Labels with user-defined metadata. - map labels = 9 [(google.api.field_behavior) = OPTIONAL]; -} - -// A [Certificate][google.cloud.security.privateca.v1beta1.Certificate] corresponds to a signed X.509 certificate issued by a -// [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. -message Certificate { - option (google.api.resource) = { - type: "privateca.googleapis.com/Certificate" - pattern: "projects/{project}/locations/{location}/certificateAuthorities/{certificate_authority}/certificates/{certificate}" - }; - - // Describes fields that are relavent to the revocation of a [Certificate][google.cloud.security.privateca.v1beta1.Certificate]. - message RevocationDetails { - // Indicates why a [Certificate][google.cloud.security.privateca.v1beta1.Certificate] was revoked. - RevocationReason revocation_state = 1; - - // The time at which this [Certificate][google.cloud.security.privateca.v1beta1.Certificate] was revoked. - google.protobuf.Timestamp revocation_time = 2; - } - - // Output only. The resource path for this [Certificate][google.cloud.security.privateca.v1beta1.Certificate] in the format - // `projects/*/locations/*/certificateAuthorities/*/certificates/*`. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The config used to create a signed X.509 certificate. - oneof certificate_config { - // Immutable. A pem-encoded X.509 certificate signing request (CSR). - string pem_csr = 2 [(google.api.field_behavior) = IMMUTABLE]; - - // Immutable. A description of the certificate and key that does not require X.509 or - // ASN.1. - CertificateConfig config = 3 [(google.api.field_behavior) = IMMUTABLE]; - } - - // Required. Immutable. The desired lifetime of a certificate. Used to create the - // "not_before_time" and "not_after_time" fields inside an X.509 - // certificate. Note that the lifetime may be truncated if it would extend - // past the life of any certificate authority in the issuing chain. - google.protobuf.Duration lifetime = 4 [ - (google.api.field_behavior) = REQUIRED, - (google.api.field_behavior) = IMMUTABLE - ]; - - // Output only. Details regarding the revocation of this [Certificate][google.cloud.security.privateca.v1beta1.Certificate]. This - // [Certificate][google.cloud.security.privateca.v1beta1.Certificate] is considered revoked if and only if this field is present. - RevocationDetails revocation_details = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The pem-encoded, signed X.509 certificate. - string pem_certificate = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A structured description of the issued X.509 certificate. - CertificateDescription certificate_description = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The chain that may be used to verify the X.509 certificate. Expected to be - // in issuer-to-root order according to RFC 5246. - repeated string pem_certificate_chain = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time at which this [Certificate][google.cloud.security.privateca.v1beta1.Certificate] was created. - google.protobuf.Timestamp create_time = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time at which this [Certificate][google.cloud.security.privateca.v1beta1.Certificate] was updated. - google.protobuf.Timestamp update_time = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Labels with user-defined metadata. - map labels = 11 [(google.api.field_behavior) = OPTIONAL]; -} - -// A [ReusableConfig][google.cloud.security.privateca.v1beta1.ReusableConfig] refers to a managed [ReusableConfigValues][google.cloud.security.privateca.v1beta1.ReusableConfigValues]. Those, in -// turn, are used to describe certain fields of an X.509 certificate, such as -// the key usage fields, fields specific to CA certificates, certificate policy -// extensions and custom extensions. -message ReusableConfig { - option (google.api.resource) = { - type: "privateca.googleapis.com/ReusableConfig" - pattern: "projects/{project}/locations/{location}/reusableConfigs/{reusable_config}" - }; - - // Output only. The resource path for this [ReusableConfig][google.cloud.security.privateca.v1beta1.ReusableConfig] in the format - // `projects/*/locations/*/reusableConfigs/*`. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Required. The config values. - ReusableConfigValues values = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A human-readable description of scenarios these ReusableConfigValues may be - // compatible with. - string description = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The time at which this [ReusableConfig][google.cloud.security.privateca.v1beta1.ReusableConfig] was created. - google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time at which this [ReusableConfig][google.cloud.security.privateca.v1beta1.ReusableConfig] was updated. - google.protobuf.Timestamp update_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Labels with user-defined metadata. - map labels = 6 [(google.api.field_behavior) = OPTIONAL]; -} - -// A [ReusableConfigValues][google.cloud.security.privateca.v1beta1.ReusableConfigValues] is used to describe certain fields of an -// X.509 certificate, such as the key usage fields, fields specific to CA -// certificates, certificate policy extensions and custom extensions. -message ReusableConfigValues { - // Describes values that are relevant in a CA certificate. - message CaOptions { - // Optional. Refers to the "CA" X.509 extension, which is a boolean value. When this - // value is missing, the extension will be omitted from the CA certificate. - google.protobuf.BoolValue is_ca = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Refers to the path length restriction X.509 extension. For a CA - // certificate, this value describes the depth of subordinate CA - // certificates that are allowed. - // If this value is less than 0, the request will fail. - // If this value is missing, the max path length will be omitted from the - // CA certificate. - google.protobuf.Int32Value max_issuer_path_length = 2 [(google.api.field_behavior) = OPTIONAL]; - } - - // Optional. Indicates the intended use for keys that correspond to a certificate. - KeyUsage key_usage = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Describes options in this [ReusableConfigValues][google.cloud.security.privateca.v1beta1.ReusableConfigValues] that are - // relevant in a CA certificate. - CaOptions ca_options = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Describes the X.509 certificate policy object identifiers, per - // https://tools.ietf.org/html/rfc5280#section-4.2.1.4. - repeated ObjectId policy_ids = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Describes Online Certificate Status Protocol (OCSP) endpoint addresses - // that appear in the "Authority Information Access" extension in the - // certificate. - repeated string aia_ocsp_servers = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Describes custom X.509 extensions. - repeated X509Extension additional_extensions = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// A [ReusableConfigWrapper][google.cloud.security.privateca.v1beta1.ReusableConfigWrapper] describes values that may assist in creating an -// X.509 certificate, or a reference to a pre-defined set of values. -message ReusableConfigWrapper { - // Reusable or inline config values. - oneof config_values { - // Required. A resource path to a [ReusableConfig][google.cloud.security.privateca.v1beta1.ReusableConfig] in the format - // `projects/*/locations/*/reusableConfigs/*`. - string reusable_config = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. A user-specified inline [ReusableConfigValues][google.cloud.security.privateca.v1beta1.ReusableConfigValues]. - ReusableConfigValues reusable_config_values = 2 [(google.api.field_behavior) = REQUIRED]; - } -} - -// Describes a subordinate CA's issuers. This is either a resource path to a -// known issuing [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority], or a PEM issuer certificate chain. -message SubordinateConfig { - // This message describes a subordinate CA's issuer certificate chain. This - // wrapper exists for compatibility reasons. - message SubordinateConfigChain { - // Required. Expected to be in leaf-to-root order according to RFC 5246. - repeated string pem_certificates = 1 [(google.api.field_behavior) = REQUIRED]; - } - - oneof subordinate_config { - // Required. This can refer to a [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] in the same project that - // was used to create a subordinate [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. This field - // is used for information and usability purposes only. The resource name - // is in the format `projects/*/locations/*/certificateAuthorities/*`. - string certificate_authority = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Contains the PEM certificate chain for the issuers of this - // [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority], but not pem certificate for this CA itself. - SubordinateConfigChain pem_issuer_chain = 2 [(google.api.field_behavior) = REQUIRED]; - } -} - -// A [PublicKey][google.cloud.security.privateca.v1beta1.PublicKey] describes a public key. -message PublicKey { - // Types of public keys that are supported. - // At a minimum, we support RSA and ECDSA, for the key sizes or curves listed: - // https://cloud.google.com/kms/docs/algorithms#asymmetric_signing_algorithms - enum KeyType { - // Default unspecified value. - KEY_TYPE_UNSPECIFIED = 0; - - // A PEM-encoded PKCS#1/RFC 3447 RSAPrivateKey structure. - PEM_RSA_KEY = 1; - - // A PEM-encoded compressed NIST P-256/secp256r1/prime256v1 or P-384 key. - PEM_EC_KEY = 2; - } - - // Required. The type of public key. - KeyType type = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. A public key. Padding and encoding varies by 'KeyType' and is described - // along with the KeyType values. - bytes key = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// A [CertificateConfig][google.cloud.security.privateca.v1beta1.CertificateConfig] describes an X.509 certificate or CSR that is to be -// created, as an alternative to using ASN.1. -message CertificateConfig { - // These values are used to create the distinguished name and subject - // alternative name fields in an X.509 certificate. - message SubjectConfig { - // Required. Contains distinguished name fields such as the location and organization. - Subject subject = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The "common name" of the distinguished name. - string common_name = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The subject alternative name fields. - SubjectAltNames subject_alt_name = 3 [(google.api.field_behavior) = OPTIONAL]; - } - - // Required. Specifies some of the values in a certificate that are related to the - // subject. - SubjectConfig subject_config = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Describes how some of the technical fields in a certificate should be - // populated. - ReusableConfigWrapper reusable_config = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The public key that corresponds to this config. This is, for example, used - // when issuing [Certificates][google.cloud.security.privateca.v1beta1.Certificate], but not when creating a - // self-signed [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] or [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] CSR. - PublicKey public_key = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// A [CertificateDescription][google.cloud.security.privateca.v1beta1.CertificateDescription] describes an X.509 certificate or CSR that has -// been issued, as an alternative to using ASN.1 / X.509. -message CertificateDescription { - // These values describe fields in an issued X.509 certificate such as the - // distinguished name, subject alternative names, serial number, and lifetime. - message SubjectDescription { - // Contains distinguished name fields such as the location and organization. - Subject subject = 1; - - // The "common name" of the distinguished name. - string common_name = 2; - - // The subject alternative name fields. - SubjectAltNames subject_alt_name = 3; - - // The serial number encoded in lowercase hexadecimal. - string hex_serial_number = 4; - - // For convenience, the actual lifetime of an issued certificate. - // Corresponds to 'not_after_time' - 'not_before_time'. - google.protobuf.Duration lifetime = 5; - - // The time at which the certificate becomes valid. - google.protobuf.Timestamp not_before_time = 6; - - // The time at which the certificate expires. - google.protobuf.Timestamp not_after_time = 7; - } - - // A KeyId identifies a specific public key, usually by hashing the public - // key. - message KeyId { - // Optional. The value of this KeyId encoded in lowercase hexadecimal. This is most - // likely the 160 bit SHA-1 hash of the public key. - string key_id = 1 [(google.api.field_behavior) = OPTIONAL]; - } - - // A group of fingerprints for the x509 certificate. - message CertificateFingerprint { - // The SHA 256 hash, encoded in hexadecimal, of the DER x509 certificate. - string sha256_hash = 1; - } - - // Describes some of the values in a certificate that are related to the - // subject and lifetime. - SubjectDescription subject_description = 1; - - // Describes some of the technical fields in a certificate. - ReusableConfigValues config_values = 2; - - // The public key that corresponds to an issued certificate. - PublicKey public_key = 3; - - // Provides a means of identifiying certificates that contain a particular - // public key, per https://tools.ietf.org/html/rfc5280#section-4.2.1.2. - KeyId subject_key_id = 4; - - // Identifies the subject_key_id of the parent certificate, per - // https://tools.ietf.org/html/rfc5280#section-4.2.1.1 - KeyId authority_key_id = 5; - - // Describes a list of locations to obtain CRL information, i.e. - // the DistributionPoint.fullName described by - // https://tools.ietf.org/html/rfc5280#section-4.2.1.13 - repeated string crl_distribution_points = 6; - - // Describes lists of issuer CA certificate URLs that appear in the - // "Authority Information Access" extension in the certificate. - repeated string aia_issuing_certificate_urls = 7; - - // The hash of the x.509 certificate. - CertificateFingerprint cert_fingerprint = 8; -} - -// An [ObjectId][google.cloud.security.privateca.v1beta1.ObjectId] specifies an object identifier (OID). These provide context -// and describe types in ASN.1 messages. -message ObjectId { - // Required. The parts of an OID path. The most significant parts of the path come - // first. - repeated int32 object_id_path = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// An [X509Extension][google.cloud.security.privateca.v1beta1.X509Extension] specifies an X.509 extension, which may be used in -// different parts of X.509 objects like certificates, CSRs, and CRLs. -message X509Extension { - // Required. The OID for this X.509 extension. - ObjectId object_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Indicates whether or not this extension is critical (i.e., if the client - // does not know how to handle this extension, the client should consider this - // to be an error). - bool critical = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The value of this X.509 extension. - bytes value = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// A [KeyUsage][google.cloud.security.privateca.v1beta1.KeyUsage] describes key usage values that may appear in an X.509 -// certificate. -message KeyUsage { - // [KeyUsage.KeyUsageOptions][google.cloud.security.privateca.v1beta1.KeyUsage.KeyUsageOptions] corresponds to the key usage values - // described in https://tools.ietf.org/html/rfc5280#section-4.2.1.3. - message KeyUsageOptions { - // The key may be used for digital signatures. - bool digital_signature = 1; - - // The key may be used for cryptographic commitments. Note that this may - // also be referred to as "non-repudiation". - bool content_commitment = 2; - - // The key may be used to encipher other keys. - bool key_encipherment = 3; - - // The key may be used to encipher data. - bool data_encipherment = 4; - - // The key may be used in a key agreement protocol. - bool key_agreement = 5; - - // The key may be used to sign certificates. - bool cert_sign = 6; - - // The key may be used sign certificate revocation lists. - bool crl_sign = 7; - - // The key may be used to encipher only. - bool encipher_only = 8; - - // The key may be used to decipher only. - bool decipher_only = 9; - } - - // [KeyUsage.ExtendedKeyUsageOptions][google.cloud.security.privateca.v1beta1.KeyUsage.ExtendedKeyUsageOptions] has fields that correspond to - // certain common OIDs that could be specified as an extended key usage value. - message ExtendedKeyUsageOptions { - // Corresponds to OID 1.3.6.1.5.5.7.3.1. Officially described as "TLS WWW - // server authentication", though regularly used for non-WWW TLS. - bool server_auth = 1; - - // Corresponds to OID 1.3.6.1.5.5.7.3.2. Officially described as "TLS WWW - // client authentication", though regularly used for non-WWW TLS. - bool client_auth = 2; - - // Corresponds to OID 1.3.6.1.5.5.7.3.3. Officially described as "Signing of - // downloadable executable code client authentication". - bool code_signing = 3; - - // Corresponds to OID 1.3.6.1.5.5.7.3.4. Officially described as "Email - // protection". - bool email_protection = 4; - - // Corresponds to OID 1.3.6.1.5.5.7.3.8. Officially described as "Binding - // the hash of an object to a time". - bool time_stamping = 5; - - // Corresponds to OID 1.3.6.1.5.5.7.3.9. Officially described as "Signing - // OCSP responses". - bool ocsp_signing = 6; - } - - // Describes high-level ways in which a key may be used. - KeyUsageOptions base_key_usage = 1; - - // Detailed scenarios in which a key may be used. - ExtendedKeyUsageOptions extended_key_usage = 2; - - // Used to describe extended key usages that are not listed in the - // [KeyUsage.ExtendedKeyUsageOptions][google.cloud.security.privateca.v1beta1.KeyUsage.ExtendedKeyUsageOptions] message. - repeated ObjectId unknown_extended_key_usages = 3; -} - -// [Subject][google.cloud.security.privateca.v1beta1.Subject] describes parts of a distinguished name that, in turn, -// describes the subject of the certificate. -message Subject { - // The country code of the subject. - string country_code = 1; - - // The organization of the subject. - string organization = 2; - - // The organizational_unit of the subject. - string organizational_unit = 3; - - // The locality or city of the subject. - string locality = 4; - - // The province, territory, or regional state of the subject. - string province = 5; - - // The street address of the subject. - string street_address = 6; - - // The postal code of the subject. - string postal_code = 7; -} - -// [SubjectAltNames][google.cloud.security.privateca.v1beta1.SubjectAltNames] corresponds to a more modern way of listing what -// the asserted identity is in a certificate (i.e., compared to the "common -// name" in the distinguished name). -message SubjectAltNames { - // Contains only valid, fully-qualified host names. - repeated string dns_names = 1; - - // Contains only valid RFC 3986 URIs. - repeated string uris = 2; - - // Contains only valid RFC 2822 E-mail addresses. - repeated string email_addresses = 3; - - // Contains only valid 32-bit IPv4 addresses or RFC 4291 IPv6 addresses. - repeated string ip_addresses = 4; - - // Contains additional subject alternative name values. - repeated X509Extension custom_sans = 5; -} - -// A [RevocationReason][google.cloud.security.privateca.v1beta1.RevocationReason] indicates whether a [Certificate][google.cloud.security.privateca.v1beta1.Certificate] has been revoked, -// and the reason for revocation. These correspond to standard revocation -// reasons from RFC 5280. Note that the enum labels and values in this -// definition are not the same ASN.1 values defined in RFC 5280. These values -// will be translated to the correct ASN.1 values when a CRL is created. -enum RevocationReason { - // Default unspecified value. This value does indicate that a [Certificate][google.cloud.security.privateca.v1beta1.Certificate] - // has been revoked, but that a reason has not been recorded. - REVOCATION_REASON_UNSPECIFIED = 0; - - // Key material for this [Certificate][google.cloud.security.privateca.v1beta1.Certificate] may have leaked. - KEY_COMPROMISE = 1; - - // The key material for a certificate authority in the issuing path may have - // leaked. - CERTIFICATE_AUTHORITY_COMPROMISE = 2; - - // The subject or other attributes in this [Certificate][google.cloud.security.privateca.v1beta1.Certificate] have changed. - AFFILIATION_CHANGED = 3; - - // This [Certificate][google.cloud.security.privateca.v1beta1.Certificate] has been superseded. - SUPERSEDED = 4; - - // This [Certificate][google.cloud.security.privateca.v1beta1.Certificate] or entities in the issuing path have ceased to - // operate. - CESSATION_OF_OPERATION = 5; - - // This [Certificate][google.cloud.security.privateca.v1beta1.Certificate] should not be considered valid, it is expected that it - // may become valid in the future. - CERTIFICATE_HOLD = 6; - - // This [Certificate][google.cloud.security.privateca.v1beta1.Certificate] no longer has permission to assert the listed - // attributes. - PRIVILEGE_WITHDRAWN = 7; - - // The authority which determines appropriate attributes for a [Certificate][google.cloud.security.privateca.v1beta1.Certificate] - // may have been compromised. - ATTRIBUTE_AUTHORITY_COMPROMISE = 8; -} diff --git a/owl-bot-staging/v1beta1/protos/google/cloud/security/privateca/v1beta1/service.proto b/owl-bot-staging/v1beta1/protos/google/cloud/security/privateca/v1beta1/service.proto deleted file mode 100644 index 3cc010d..0000000 --- a/owl-bot-staging/v1beta1/protos/google/cloud/security/privateca/v1beta1/service.proto +++ /dev/null @@ -1,871 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.security.privateca.v1beta1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/security/privateca/v1beta1/resources.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Security.PrivateCA.V1Beta1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/security/privateca/v1beta1;privateca"; -option java_multiple_files = true; -option java_outer_classname = "PrivateCaProto"; -option java_package = "com.google.cloud.security.privateca.v1beta1"; -option php_namespace = "Google\\Cloud\\Security\\PrivateCA\\V1beta1"; -option ruby_package = "Google::Cloud::Security::PrivateCA::V1beta1"; - -// [Certificate Authority Service][google.cloud.security.privateca.v1beta1.CertificateAuthorityService] manages private -// certificate authorities and issued certificates. -service CertificateAuthorityService { - option (google.api.default_host) = "privateca.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Create a new [Certificate][google.cloud.security.privateca.v1beta1.Certificate] in a given Project, Location from a particular - // [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - rpc CreateCertificate(CreateCertificateRequest) returns (Certificate) { - option (google.api.http) = { - post: "/v1beta1/{parent=projects/*/locations/*/certificateAuthorities/*}/certificates" - body: "certificate" - }; - option (google.api.method_signature) = "parent,certificate,certificate_id"; - } - - // Returns a [Certificate][google.cloud.security.privateca.v1beta1.Certificate]. - rpc GetCertificate(GetCertificateRequest) returns (Certificate) { - option (google.api.http) = { - get: "/v1beta1/{name=projects/*/locations/*/certificateAuthorities/*/certificates/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. - rpc ListCertificates(ListCertificatesRequest) returns (ListCertificatesResponse) { - option (google.api.http) = { - get: "/v1beta1/{parent=projects/*/locations/*/certificateAuthorities/*}/certificates" - }; - option (google.api.method_signature) = "parent"; - } - - // Revoke a [Certificate][google.cloud.security.privateca.v1beta1.Certificate]. - rpc RevokeCertificate(RevokeCertificateRequest) returns (Certificate) { - option (google.api.http) = { - post: "/v1beta1/{name=projects/*/locations/*/certificateAuthorities/*/certificates/*}:revoke" - body: "*" - }; - option (google.api.method_signature) = "name"; - } - - // Update a [Certificate][google.cloud.security.privateca.v1beta1.Certificate]. Currently, the only field you can update is the - // [labels][google.cloud.security.privateca.v1beta1.Certificate.labels] field. - rpc UpdateCertificate(UpdateCertificateRequest) returns (Certificate) { - option (google.api.http) = { - patch: "/v1beta1/{certificate.name=projects/*/locations/*/certificateAuthorities/*/certificates/*}" - body: "certificate" - }; - option (google.api.method_signature) = "certificate,update_mask"; - } - - // Activate a [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] that is in state - // [PENDING_ACTIVATION][google.cloud.security.privateca.v1beta1.CertificateAuthority.State.PENDING_ACTIVATION] and is - // of type [SUBORDINATE][google.cloud.security.privateca.v1beta1.CertificateAuthority.Type.SUBORDINATE]. After the - // parent Certificate Authority signs a certificate signing request from - // [FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.FetchCertificateAuthorityCsr], this method can complete the activation - // process. - rpc ActivateCertificateAuthority(ActivateCertificateAuthorityRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta1/{name=projects/*/locations/*/certificateAuthorities/*}:activate" - body: "*" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "CertificateAuthority" - metadata_type: "OperationMetadata" - }; - } - - // Create a new [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] in a given Project and Location. - rpc CreateCertificateAuthority(CreateCertificateAuthorityRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta1/{parent=projects/*/locations/*}/certificateAuthorities" - body: "certificate_authority" - }; - option (google.api.method_signature) = "parent,certificate_authority,certificate_authority_id"; - option (google.longrunning.operation_info) = { - response_type: "CertificateAuthority" - metadata_type: "OperationMetadata" - }; - } - - // Disable a [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - rpc DisableCertificateAuthority(DisableCertificateAuthorityRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta1/{name=projects/*/locations/*/certificateAuthorities/*}:disable" - body: "*" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "CertificateAuthority" - metadata_type: "OperationMetadata" - }; - } - - // Enable a [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - rpc EnableCertificateAuthority(EnableCertificateAuthorityRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta1/{name=projects/*/locations/*/certificateAuthorities/*}:enable" - body: "*" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "CertificateAuthority" - metadata_type: "OperationMetadata" - }; - } - - // Fetch a certificate signing request (CSR) from a [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - // that is in state - // [PENDING_ACTIVATION][google.cloud.security.privateca.v1beta1.CertificateAuthority.State.PENDING_ACTIVATION] and is - // of type [SUBORDINATE][google.cloud.security.privateca.v1beta1.CertificateAuthority.Type.SUBORDINATE]. The CSR must - // then be signed by the desired parent Certificate Authority, which could be - // another [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] resource, or could be an on-prem - // certificate authority. See also [ActivateCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ActivateCertificateAuthority]. - rpc FetchCertificateAuthorityCsr(FetchCertificateAuthorityCsrRequest) returns (FetchCertificateAuthorityCsrResponse) { - option (google.api.http) = { - get: "/v1beta1/{name=projects/*/locations/*/certificateAuthorities/*}:fetch" - }; - option (google.api.method_signature) = "name"; - } - - // Returns a [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - rpc GetCertificateAuthority(GetCertificateAuthorityRequest) returns (CertificateAuthority) { - option (google.api.http) = { - get: "/v1beta1/{name=projects/*/locations/*/certificateAuthorities/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists [CertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - rpc ListCertificateAuthorities(ListCertificateAuthoritiesRequest) returns (ListCertificateAuthoritiesResponse) { - option (google.api.http) = { - get: "/v1beta1/{parent=projects/*/locations/*}/certificateAuthorities" - }; - option (google.api.method_signature) = "parent"; - } - - // Restore a [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] that is scheduled for deletion. - rpc RestoreCertificateAuthority(RestoreCertificateAuthorityRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta1/{name=projects/*/locations/*/certificateAuthorities/*}:restore" - body: "*" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "CertificateAuthority" - metadata_type: "OperationMetadata" - }; - } - - // Schedule a [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] for deletion. - rpc ScheduleDeleteCertificateAuthority(ScheduleDeleteCertificateAuthorityRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta1/{name=projects/*/locations/*/certificateAuthorities/*}:scheduleDelete" - body: "*" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "CertificateAuthority" - metadata_type: "OperationMetadata" - }; - } - - // Update a [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - rpc UpdateCertificateAuthority(UpdateCertificateAuthorityRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1beta1/{certificate_authority.name=projects/*/locations/*/certificateAuthorities/*}" - body: "certificate_authority" - }; - option (google.api.method_signature) = "certificate_authority,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "CertificateAuthority" - metadata_type: "OperationMetadata" - }; - } - - // Returns a [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList]. - rpc GetCertificateRevocationList(GetCertificateRevocationListRequest) returns (CertificateRevocationList) { - option (google.api.http) = { - get: "/v1beta1/{name=projects/*/locations/*/certificateAuthorities/*/certificateRevocationLists/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists [CertificateRevocationLists][google.cloud.security.privateca.v1beta1.CertificateRevocationList]. - rpc ListCertificateRevocationLists(ListCertificateRevocationListsRequest) returns (ListCertificateRevocationListsResponse) { - option (google.api.http) = { - get: "/v1beta1/{parent=projects/*/locations/*/certificateAuthorities/*}/certificateRevocationLists" - }; - option (google.api.method_signature) = "parent"; - } - - // Update a [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList]. - rpc UpdateCertificateRevocationList(UpdateCertificateRevocationListRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1beta1/{certificate_revocation_list.name=projects/*/locations/*/certificateAuthorities/*/certificateRevocationLists/*}" - body: "certificate_revocation_list" - }; - option (google.api.method_signature) = "certificate_revocation_list,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "CertificateRevocationList" - metadata_type: "OperationMetadata" - }; - } - - // Returns a [ReusableConfig][google.cloud.security.privateca.v1beta1.ReusableConfig]. - rpc GetReusableConfig(GetReusableConfigRequest) returns (ReusableConfig) { - option (google.api.http) = { - get: "/v1beta1/{name=projects/*/locations/*/reusableConfigs/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists [ReusableConfigs][google.cloud.security.privateca.v1beta1.ReusableConfig]. - rpc ListReusableConfigs(ListReusableConfigsRequest) returns (ListReusableConfigsResponse) { - option (google.api.http) = { - get: "/v1beta1/{parent=projects/*/locations/*}/reusableConfigs" - }; - option (google.api.method_signature) = "parent"; - } -} - -// Request message for [CertificateAuthorityService.CreateCertificate][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.CreateCertificate]. -message CreateCertificateRequest { - // Required. The resource name of the location and [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - // associated with the [Certificate][google.cloud.security.privateca.v1beta1.Certificate], in the format - // `projects/*/locations/*/certificateAuthorities/*`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "privateca.googleapis.com/CertificateAuthority" - } - ]; - - // Optional. It must be unique within a location and match the regular - // expression `[a-zA-Z0-9_-]{1,63}`. This field is required when using a - // [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] in the Enterprise [CertificateAuthority.Tier][google.cloud.security.privateca.v1beta1.CertificateAuthority.Tier], - // but is optional and its value is ignored otherwise. - string certificate_id = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Required. A [Certificate][google.cloud.security.privateca.v1beta1.Certificate] with initial field values. - Certificate certificate = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. An ID to identify requests. Specify a unique request ID so that if you must - // retry your request, the server will know to ignore the request if it has - // already been completed. The server will guarantee that for at least 60 - // minutes since the first request. - // - // For example, consider a situation where you make an initial request and t - // he request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [CertificateAuthorityService.GetCertificate][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetCertificate]. -message GetCertificateRequest { - // Required. The [name][google.cloud.security.privateca.v1beta1.Certificate.name] of the [Certificate][google.cloud.security.privateca.v1beta1.Certificate] to get. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "privateca.googleapis.com/Certificate" - } - ]; -} - -// Request message for [CertificateAuthorityService.ListCertificates][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificates]. -message ListCertificatesRequest { - // Required. The resource name of the location associated with the - // [Certificates][google.cloud.security.privateca.v1beta1.Certificate], in the format - // `projects/*/locations/*/certificateauthorities/*`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "privateca.googleapis.com/CertificateAuthority" - } - ]; - - // Optional. Limit on the number of - // [Certificates][google.cloud.security.privateca.v1beta1.Certificate] to include in the - // response. Further [Certificates][google.cloud.security.privateca.v1beta1.Certificate] can subsequently be obtained - // by including the - // [ListCertificatesResponse.next_page_token][google.cloud.security.privateca.v1beta1.ListCertificatesResponse.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. Pagination token, returned earlier via - // [ListCertificatesResponse.next_page_token][google.cloud.security.privateca.v1beta1.ListCertificatesResponse.next_page_token]. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Only include resources that match the filter in the response. For details - // on supported filters and syntax, see [Certificates Filtering - // documentation](https://cloud.google.com/certificate-authority-service/docs/sorting-filtering-certificates#filtering_support). - string filter = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specify how the results should be sorted. For details on supported fields - // and syntax, see [Certificates Sorting - // documentation](https://cloud.google.com/certificate-authority-service/docs/sorting-filtering-certificates#sorting_support). - string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for [CertificateAuthorityService.ListCertificates][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificates]. -message ListCertificatesResponse { - // The list of [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. - repeated Certificate certificates = 1; - - // A token to retrieve next page of results. Pass this value in - // [ListCertificatesRequest.next_page_token][] to retrieve the - // next page of results. - string next_page_token = 2; - - // A list of locations (e.g. "us-west1") that could not be reached. - repeated string unreachable = 3; -} - -// Request message for -// [CertificateAuthorityService.RevokeCertificate][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.RevokeCertificate]. -message RevokeCertificateRequest { - // Required. The resource name for this [Certificate][google.cloud.security.privateca.v1beta1.Certificate] in the - // format `projects/*/locations/*/certificateAuthorities/*/certificates/*`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "privateca.googleapis.com/Certificate" - } - ]; - - // Required. The [RevocationReason][google.cloud.security.privateca.v1beta1.RevocationReason] for revoking this certificate. - RevocationReason reason = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. An ID to identify requests. Specify a unique request ID so that if you must - // retry your request, the server will know to ignore the request if it has - // already been completed. The server will guarantee that for at least 60 - // minutes since the first request. - // - // For example, consider a situation where you make an initial request and t - // he request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for [CertificateAuthorityService.UpdateCertificate][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.UpdateCertificate]. -message UpdateCertificateRequest { - // Required. [Certificate][google.cloud.security.privateca.v1beta1.Certificate] with updated values. - Certificate certificate = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. A list of fields to be updated in this request. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. An ID to identify requests. Specify a unique request ID so that if you must - // retry your request, the server will know to ignore the request if it has - // already been completed. The server will guarantee that for at least 60 - // minutes since the first request. - // - // For example, consider a situation where you make an initial request and t - // he request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [CertificateAuthorityService.ActivateCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ActivateCertificateAuthority]. -message ActivateCertificateAuthorityRequest { - // Required. The resource name for this [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] in the - // format `projects/*/locations/*/certificateAuthorities/*`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "privateca.googleapis.com/CertificateAuthority" - } - ]; - - // Required. The signed CA certificate issued from - // [FetchCertificateAuthorityCsrResponse.pem_csr][google.cloud.security.privateca.v1beta1.FetchCertificateAuthorityCsrResponse.pem_csr]. - string pem_ca_certificate = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Must include information about the issuer of 'pem_ca_certificate', and any - // further issuers until the self-signed CA. - SubordinateConfig subordinate_config = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. An ID to identify requests. Specify a unique request ID so that if you must - // retry your request, the server will know to ignore the request if it has - // already been completed. The server will guarantee that for at least 60 - // minutes since the first request. - // - // For example, consider a situation where you make an initial request and t - // he request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [CertificateAuthorityService.CreateCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.CreateCertificateAuthority]. -message CreateCertificateAuthorityRequest { - // Required. The resource name of the location associated with the - // [CertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthority], 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 certificate_authority_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. A [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] with initial field values. - CertificateAuthority certificate_authority = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. An ID to identify requests. Specify a unique request ID so that if you must - // retry your request, the server will know to ignore the request if it has - // already been completed. The server will guarantee that for at least 60 - // minutes since the first request. - // - // For example, consider a situation where you make an initial request and t - // he request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [CertificateAuthorityService.DisableCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.DisableCertificateAuthority]. -message DisableCertificateAuthorityRequest { - // Required. The resource name for this [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] in the - // format `projects/*/locations/*/certificateAuthorities/*`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "privateca.googleapis.com/CertificateAuthority" - } - ]; - - // Optional. An ID to identify requests. Specify a unique request ID so that if you must - // retry your request, the server will know to ignore the request if it has - // already been completed. The server will guarantee that for at least 60 - // minutes since the first request. - // - // For example, consider a situation where you make an initial request and t - // he request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [CertificateAuthorityService.EnableCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.EnableCertificateAuthority]. -message EnableCertificateAuthorityRequest { - // Required. The resource name for this [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] in the - // format `projects/*/locations/*/certificateAuthorities/*`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "privateca.googleapis.com/CertificateAuthority" - } - ]; - - // Optional. An ID to identify requests. Specify a unique request ID so that if you must - // retry your request, the server will know to ignore the request if it has - // already been completed. The server will guarantee that for at least 60 - // minutes since the first request. - // - // For example, consider a situation where you make an initial request and t - // he request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [CertificateAuthorityService.FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.FetchCertificateAuthorityCsr]. -message FetchCertificateAuthorityCsrRequest { - // Required. The resource name for this [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] in the - // format `projects/*/locations/*/certificateAuthorities/*`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "privateca.googleapis.com/CertificateAuthority" - } - ]; -} - -// Response message for -// [CertificateAuthorityService.FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.FetchCertificateAuthorityCsr]. -message FetchCertificateAuthorityCsrResponse { - // Output only. The PEM-encoded signed certificate signing request (CSR). - string pem_csr = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Request message for [CertificateAuthorityService.GetCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetCertificateAuthority]. -message GetCertificateAuthorityRequest { - // Required. The [name][google.cloud.security.privateca.v1beta1.CertificateAuthority.name] of the [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] to - // get. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "privateca.googleapis.com/CertificateAuthority" - } - ]; -} - -// Request message for -// [CertificateAuthorityService.ListCertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificateAuthorities]. -message ListCertificateAuthoritiesRequest { - // Required. The resource name of the location associated with the - // [CertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthority], in the format - // `projects/*/locations/*`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Optional. Limit on the number of [CertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthority] to - // include in the response. - // Further [CertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthority] can subsequently be - // obtained by including the - // [ListCertificateAuthoritiesResponse.next_page_token][google.cloud.security.privateca.v1beta1.ListCertificateAuthoritiesResponse.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. Pagination token, returned earlier via - // [ListCertificateAuthoritiesResponse.next_page_token][google.cloud.security.privateca.v1beta1.ListCertificateAuthoritiesResponse.next_page_token]. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Only include resources that match the filter in the response. - string filter = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specify how the results should be sorted. - string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for -// [CertificateAuthorityService.ListCertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificateAuthorities]. -message ListCertificateAuthoritiesResponse { - // The list of [CertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - repeated CertificateAuthority certificate_authorities = 1; - - // A token to retrieve next page of results. Pass this value in - // [ListCertificateAuthoritiesRequest.next_page_token][] to retrieve the next - // page of results. - string next_page_token = 2; - - // A list of locations (e.g. "us-west1") that could not be reached. - repeated string unreachable = 3; -} - -// Request message for -// [CertificateAuthorityService.RestoreCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.RestoreCertificateAuthority]. -message RestoreCertificateAuthorityRequest { - // Required. The resource name for this [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] in the - // format `projects/*/locations/*/certificateAuthorities/*`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "privateca.googleapis.com/CertificateAuthority" - } - ]; - - // Optional. An ID to identify requests. Specify a unique request ID so that if you must - // retry your request, the server will know to ignore the request if it has - // already been completed. The server will guarantee that for at least 60 - // minutes since the first request. - // - // For example, consider a situation where you make an initial request and t - // he request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [CertificateAuthorityService.ScheduleDeleteCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ScheduleDeleteCertificateAuthority]. -message ScheduleDeleteCertificateAuthorityRequest { - // Required. The resource name for this [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] in the - // format `projects/*/locations/*/certificateAuthorities/*`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "privateca.googleapis.com/CertificateAuthority" - } - ]; - - // Optional. An ID to identify requests. Specify a unique request ID so that if you must - // retry your request, the server will know to ignore the request if it has - // already been completed. The server will guarantee that for at least 60 - // minutes since the first request. - // - // For example, consider a situation where you make an initial request and t - // he request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [CertificateAuthorityService.UpdateCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.UpdateCertificateAuthority]. -message UpdateCertificateAuthorityRequest { - // Required. [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] with updated values. - CertificateAuthority certificate_authority = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. A list of fields to be updated in this request. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. An ID to identify requests. Specify a unique request ID so that if you must - // retry your request, the server will know to ignore the request if it has - // already been completed. The server will guarantee that for at least 60 - // minutes since the first request. - // - // For example, consider a situation where you make an initial request and t - // he request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [CertificateAuthorityService.GetCertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetCertificateRevocationList]. -message GetCertificateRevocationListRequest { - // Required. The [name][google.cloud.security.privateca.v1beta1.CertificateRevocationList.name] of the - // [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList] to get. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "privateca.googleapis.com/CertificateRevocationList" - } - ]; -} - -// Request message for -// [CertificateAuthorityService.ListCertificateRevocationLists][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificateRevocationLists]. -message ListCertificateRevocationListsRequest { - // Required. The resource name of the location associated with the - // [CertificateRevocationLists][google.cloud.security.privateca.v1beta1.CertificateRevocationList], in the format - // `projects/*/locations/*/certificateauthorities/*`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "privateca.googleapis.com/CertificateAuthority" - } - ]; - - // Optional. Limit on the number of - // [CertificateRevocationLists][google.cloud.security.privateca.v1beta1.CertificateRevocationList] to include in the - // response. Further [CertificateRevocationLists][google.cloud.security.privateca.v1beta1.CertificateRevocationList] - // can subsequently be obtained by including the - // [ListCertificateRevocationListsResponse.next_page_token][google.cloud.security.privateca.v1beta1.ListCertificateRevocationListsResponse.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. Pagination token, returned earlier via - // [ListCertificateRevocationListsResponse.next_page_token][google.cloud.security.privateca.v1beta1.ListCertificateRevocationListsResponse.next_page_token]. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Only include resources that match the filter in the response. - string filter = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specify how the results should be sorted. - string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for -// [CertificateAuthorityService.ListCertificateRevocationLists][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificateRevocationLists]. -message ListCertificateRevocationListsResponse { - // The list of [CertificateRevocationLists][google.cloud.security.privateca.v1beta1.CertificateRevocationList]. - repeated CertificateRevocationList certificate_revocation_lists = 1; - - // A token to retrieve next page of results. Pass this value in - // [ListCertificateRevocationListsRequest.next_page_token][] to retrieve the - // next page of results. - string next_page_token = 2; - - // A list of locations (e.g. "us-west1") that could not be reached. - repeated string unreachable = 3; -} - -// Request message for -// [CertificateAuthorityService.UpdateCertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.UpdateCertificateRevocationList]. -message UpdateCertificateRevocationListRequest { - // Required. [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList] with updated values. - CertificateRevocationList certificate_revocation_list = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. A list of fields to be updated in this request. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. An ID to identify requests. Specify a unique request ID so that if you must - // retry your request, the server will know to ignore the request if it has - // already been completed. The server will guarantee that for at least 60 - // minutes since the first request. - // - // For example, consider a situation where you make an initial request and t - // he request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [CertificateAuthorityService.GetReusableConfig][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetReusableConfig]. -message GetReusableConfigRequest { - // Required. The [name][ReusableConfigs.name] of the [ReusableConfigs][] to get. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "privateca.googleapis.com/ReusableConfig" - } - ]; -} - -// Request message for -// [CertificateAuthorityService.ListReusableConfigs][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListReusableConfigs]. -message ListReusableConfigsRequest { - // Required. The resource name of the location associated with the - // [ReusableConfigs][google.cloud.security.privateca.v1beta1.ReusableConfig], in the format - // `projects/*/locations/*`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Optional. Limit on the number of - // [ReusableConfigs][google.cloud.security.privateca.v1beta1.ReusableConfig] to include in the response. - // Further [ReusableConfigs][google.cloud.security.privateca.v1beta1.ReusableConfig] can subsequently be - // obtained by including the - // [ListReusableConfigsResponse.next_page_token][google.cloud.security.privateca.v1beta1.ListReusableConfigsResponse.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. Pagination token, returned earlier via - // [ListReusableConfigsResponse.next_page_token][google.cloud.security.privateca.v1beta1.ListReusableConfigsResponse.next_page_token]. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Only include resources that match the filter in the response. - string filter = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specify how the results should be sorted. - string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for -// [CertificateAuthorityService.ListReusableConfigs][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListReusableConfigs]. -message ListReusableConfigsResponse { - // The list of [ReusableConfigs][google.cloud.security.privateca.v1beta1.ReusableConfig]. - repeated ReusableConfig reusable_configs = 1; - - // A token to retrieve next page of results. Pass this value in - // [ListReusableConfigsRequest.next_page_token][] to retrieve - // the next page of results. - string next_page_token = 2; - - // A list of locations (e.g. "us-west1") that could not be reached. - repeated string unreachable = 3; -} - -// Represents the metadata of the long-running operation. -message OperationMetadata { - // Output only. The time the operation was created. - google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the operation finished running. - google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Server-defined resource path for the target of the operation. - string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Name of the verb executed by the operation. - string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Human-readable status of the operation, if any. - string status_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Identifies whether the user has requested cancellation - // of the operation. Operations that have successfully been cancelled - // have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, - // corresponding to `Code.CANCELLED`. - bool requested_cancellation = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. API version used to start the operation. - string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.activate_certificate_authority.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.activate_certificate_authority.js deleted file mode 100644 index 70d2932..0000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.activate_certificate_authority.js +++ /dev/null @@ -1,86 +0,0 @@ -// 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, pemCaCertificate, subordinateConfig) { - // [START privateca_v1beta1_generated_CertificateAuthorityService_ActivateCertificateAuthority_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name for this CertificateAuthority google.cloud.security.privateca.v1beta1.CertificateAuthority in the - * format `projects/* /locations/* /certificateAuthorities/*`. - */ - // const name = 'abc123' - /** - * Required. The signed CA certificate issued from - * FetchCertificateAuthorityCsrResponse.pem_csr google.cloud.security.privateca.v1beta1.FetchCertificateAuthorityCsrResponse.pem_csr. - */ - // const pemCaCertificate = 'abc123' - /** - * Required. Must include information about the issuer of 'pem_ca_certificate', and any - * further issuers until the self-signed CA. - */ - // const subordinateConfig = {} - /** - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Privateca library - const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1beta1; - - // Instantiates a client - const privatecaClient = new CertificateAuthorityServiceClient(); - - async function callActivateCertificateAuthority() { - // Construct request - const request = { - name, - pemCaCertificate, - subordinateConfig, - }; - - // Run request - const [operation] = await privatecaClient.activateCertificateAuthority(request); - const [response] = await operation.promise(); - console.log(response); - } - - callActivateCertificateAuthority(); - // [END privateca_v1beta1_generated_CertificateAuthorityService_ActivateCertificateAuthority_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.create_certificate.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.create_certificate.js deleted file mode 100644 index df83e0f..0000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.create_certificate.js +++ /dev/null @@ -1,86 +0,0 @@ -// 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, certificate) { - // [START privateca_v1beta1_generated_CertificateAuthorityService_CreateCertificate_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the location and CertificateAuthority google.cloud.security.privateca.v1beta1.CertificateAuthority - * associated with the Certificate google.cloud.security.privateca.v1beta1.Certificate, in the format - * `projects/* /locations/* /certificateAuthorities/*`. - */ - // const parent = 'abc123' - /** - * Optional. It must be unique within a location and match the regular - * expression `[a-zA-Z0-9_-]{1,63}`. This field is required when using a - * CertificateAuthority google.cloud.security.privateca.v1beta1.CertificateAuthority in the Enterprise CertificateAuthority.Tier google.cloud.security.privateca.v1beta1.CertificateAuthority.Tier, - * but is optional and its value is ignored otherwise. - */ - // const certificateId = 'abc123' - /** - * Required. A Certificate google.cloud.security.privateca.v1beta1.Certificate with initial field values. - */ - // const certificate = {} - /** - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Privateca library - const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1beta1; - - // Instantiates a client - const privatecaClient = new CertificateAuthorityServiceClient(); - - async function callCreateCertificate() { - // Construct request - const request = { - parent, - certificate, - }; - - // Run request - const response = await privatecaClient.createCertificate(request); - console.log(response); - } - - callCreateCertificate(); - // [END privateca_v1beta1_generated_CertificateAuthorityService_CreateCertificate_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.create_certificate_authority.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.create_certificate_authority.js deleted file mode 100644 index eafbbda..0000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.create_certificate_authority.js +++ /dev/null @@ -1,86 +0,0 @@ -// 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, certificateAuthorityId, certificateAuthority) { - // [START privateca_v1beta1_generated_CertificateAuthorityService_CreateCertificateAuthority_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the location associated with the - * CertificateAuthorities google.cloud.security.privateca.v1beta1.CertificateAuthority, 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 certificateAuthorityId = 'abc123' - /** - * Required. A CertificateAuthority google.cloud.security.privateca.v1beta1.CertificateAuthority with initial field values. - */ - // const certificateAuthority = {} - /** - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Privateca library - const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1beta1; - - // Instantiates a client - const privatecaClient = new CertificateAuthorityServiceClient(); - - async function callCreateCertificateAuthority() { - // Construct request - const request = { - parent, - certificateAuthorityId, - certificateAuthority, - }; - - // Run request - const [operation] = await privatecaClient.createCertificateAuthority(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateCertificateAuthority(); - // [END privateca_v1beta1_generated_CertificateAuthorityService_CreateCertificateAuthority_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.disable_certificate_authority.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.disable_certificate_authority.js deleted file mode 100644 index 8f61656..0000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.disable_certificate_authority.js +++ /dev/null @@ -1,74 +0,0 @@ -// 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 privateca_v1beta1_generated_CertificateAuthorityService_DisableCertificateAuthority_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name for this CertificateAuthority google.cloud.security.privateca.v1beta1.CertificateAuthority in the - * format `projects/* /locations/* /certificateAuthorities/*`. - */ - // const name = 'abc123' - /** - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Privateca library - const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1beta1; - - // Instantiates a client - const privatecaClient = new CertificateAuthorityServiceClient(); - - async function callDisableCertificateAuthority() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await privatecaClient.disableCertificateAuthority(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDisableCertificateAuthority(); - // [END privateca_v1beta1_generated_CertificateAuthorityService_DisableCertificateAuthority_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.enable_certificate_authority.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.enable_certificate_authority.js deleted file mode 100644 index d6e053a..0000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.enable_certificate_authority.js +++ /dev/null @@ -1,74 +0,0 @@ -// 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 privateca_v1beta1_generated_CertificateAuthorityService_EnableCertificateAuthority_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name for this CertificateAuthority google.cloud.security.privateca.v1beta1.CertificateAuthority in the - * format `projects/* /locations/* /certificateAuthorities/*`. - */ - // const name = 'abc123' - /** - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Privateca library - const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1beta1; - - // Instantiates a client - const privatecaClient = new CertificateAuthorityServiceClient(); - - async function callEnableCertificateAuthority() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await privatecaClient.enableCertificateAuthority(request); - const [response] = await operation.promise(); - console.log(response); - } - - callEnableCertificateAuthority(); - // [END privateca_v1beta1_generated_CertificateAuthorityService_EnableCertificateAuthority_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.fetch_certificate_authority_csr.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.fetch_certificate_authority_csr.js deleted file mode 100644 index f4a09ff..0000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.fetch_certificate_authority_csr.js +++ /dev/null @@ -1,59 +0,0 @@ -// 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 privateca_v1beta1_generated_CertificateAuthorityService_FetchCertificateAuthorityCsr_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name for this CertificateAuthority google.cloud.security.privateca.v1beta1.CertificateAuthority in the - * format `projects/* /locations/* /certificateAuthorities/*`. - */ - // const name = 'abc123' - - // Imports the Privateca library - const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1beta1; - - // Instantiates a client - const privatecaClient = new CertificateAuthorityServiceClient(); - - async function callFetchCertificateAuthorityCsr() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await privatecaClient.fetchCertificateAuthorityCsr(request); - console.log(response); - } - - callFetchCertificateAuthorityCsr(); - // [END privateca_v1beta1_generated_CertificateAuthorityService_FetchCertificateAuthorityCsr_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.get_certificate.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.get_certificate.js deleted file mode 100644 index 7bdaefb..0000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.get_certificate.js +++ /dev/null @@ -1,58 +0,0 @@ -// 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 privateca_v1beta1_generated_CertificateAuthorityService_GetCertificate_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name google.cloud.security.privateca.v1beta1.Certificate.name of the Certificate google.cloud.security.privateca.v1beta1.Certificate to get. - */ - // const name = 'abc123' - - // Imports the Privateca library - const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1beta1; - - // Instantiates a client - const privatecaClient = new CertificateAuthorityServiceClient(); - - async function callGetCertificate() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await privatecaClient.getCertificate(request); - console.log(response); - } - - callGetCertificate(); - // [END privateca_v1beta1_generated_CertificateAuthorityService_GetCertificate_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.get_certificate_authority.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.get_certificate_authority.js deleted file mode 100644 index 0f0642d..0000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.get_certificate_authority.js +++ /dev/null @@ -1,59 +0,0 @@ -// 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 privateca_v1beta1_generated_CertificateAuthorityService_GetCertificateAuthority_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name google.cloud.security.privateca.v1beta1.CertificateAuthority.name of the CertificateAuthority google.cloud.security.privateca.v1beta1.CertificateAuthority to - * get. - */ - // const name = 'abc123' - - // Imports the Privateca library - const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1beta1; - - // Instantiates a client - const privatecaClient = new CertificateAuthorityServiceClient(); - - async function callGetCertificateAuthority() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await privatecaClient.getCertificateAuthority(request); - console.log(response); - } - - callGetCertificateAuthority(); - // [END privateca_v1beta1_generated_CertificateAuthorityService_GetCertificateAuthority_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.get_certificate_revocation_list.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.get_certificate_revocation_list.js deleted file mode 100644 index 4e3aa98..0000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.get_certificate_revocation_list.js +++ /dev/null @@ -1,59 +0,0 @@ -// 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 privateca_v1beta1_generated_CertificateAuthorityService_GetCertificateRevocationList_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name google.cloud.security.privateca.v1beta1.CertificateRevocationList.name of the - * CertificateRevocationList google.cloud.security.privateca.v1beta1.CertificateRevocationList to get. - */ - // const name = 'abc123' - - // Imports the Privateca library - const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1beta1; - - // Instantiates a client - const privatecaClient = new CertificateAuthorityServiceClient(); - - async function callGetCertificateRevocationList() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await privatecaClient.getCertificateRevocationList(request); - console.log(response); - } - - callGetCertificateRevocationList(); - // [END privateca_v1beta1_generated_CertificateAuthorityService_GetCertificateRevocationList_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.get_reusable_config.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.get_reusable_config.js deleted file mode 100644 index 52caa32..0000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.get_reusable_config.js +++ /dev/null @@ -1,58 +0,0 @@ -// 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 privateca_v1beta1_generated_CertificateAuthorityService_GetReusableConfig_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name ReusableConfigs.name of the ReusableConfigs to get. - */ - // const name = 'abc123' - - // Imports the Privateca library - const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1beta1; - - // Instantiates a client - const privatecaClient = new CertificateAuthorityServiceClient(); - - async function callGetReusableConfig() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await privatecaClient.getReusableConfig(request); - console.log(response); - } - - callGetReusableConfig(); - // [END privateca_v1beta1_generated_CertificateAuthorityService_GetReusableConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.list_certificate_authorities.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.list_certificate_authorities.js deleted file mode 100644 index 73c847e..0000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.list_certificate_authorities.js +++ /dev/null @@ -1,84 +0,0 @@ -// 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 privateca_v1beta1_generated_CertificateAuthorityService_ListCertificateAuthorities_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the location associated with the - * CertificateAuthorities google.cloud.security.privateca.v1beta1.CertificateAuthority, in the format - * `projects/* /locations/*`. - */ - // const parent = 'abc123' - /** - * Optional. Limit on the number of CertificateAuthorities google.cloud.security.privateca.v1beta1.CertificateAuthority to - * include in the response. - * Further CertificateAuthorities google.cloud.security.privateca.v1beta1.CertificateAuthority can subsequently be - * obtained by including the - * ListCertificateAuthoritiesResponse.next_page_token google.cloud.security.privateca.v1beta1.ListCertificateAuthoritiesResponse.next_page_token in a subsequent - * request. If unspecified, the server will pick an appropriate default. - */ - // const pageSize = 1234 - /** - * Optional. Pagination token, returned earlier via - * ListCertificateAuthoritiesResponse.next_page_token google.cloud.security.privateca.v1beta1.ListCertificateAuthoritiesResponse.next_page_token. - */ - // const pageToken = 'abc123' - /** - * Optional. Only include resources that match the filter in the response. - */ - // const filter = 'abc123' - /** - * Optional. Specify how the results should be sorted. - */ - // const orderBy = 'abc123' - - // Imports the Privateca library - const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1beta1; - - // Instantiates a client - const privatecaClient = new CertificateAuthorityServiceClient(); - - async function callListCertificateAuthorities() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await privatecaClient.listCertificateAuthoritiesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListCertificateAuthorities(); - // [END privateca_v1beta1_generated_CertificateAuthorityService_ListCertificateAuthorities_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.list_certificate_revocation_lists.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.list_certificate_revocation_lists.js deleted file mode 100644 index c101c2e..0000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.list_certificate_revocation_lists.js +++ /dev/null @@ -1,84 +0,0 @@ -// 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 privateca_v1beta1_generated_CertificateAuthorityService_ListCertificateRevocationLists_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the location associated with the - * CertificateRevocationLists google.cloud.security.privateca.v1beta1.CertificateRevocationList, in the format - * `projects/* /locations/* /certificateauthorities/*`. - */ - // const parent = 'abc123' - /** - * Optional. Limit on the number of - * CertificateRevocationLists google.cloud.security.privateca.v1beta1.CertificateRevocationList to include in the - * response. Further CertificateRevocationLists google.cloud.security.privateca.v1beta1.CertificateRevocationList - * can subsequently be obtained by including the - * ListCertificateRevocationListsResponse.next_page_token google.cloud.security.privateca.v1beta1.ListCertificateRevocationListsResponse.next_page_token in a subsequent - * request. If unspecified, the server will pick an appropriate default. - */ - // const pageSize = 1234 - /** - * Optional. Pagination token, returned earlier via - * ListCertificateRevocationListsResponse.next_page_token google.cloud.security.privateca.v1beta1.ListCertificateRevocationListsResponse.next_page_token. - */ - // const pageToken = 'abc123' - /** - * Optional. Only include resources that match the filter in the response. - */ - // const filter = 'abc123' - /** - * Optional. Specify how the results should be sorted. - */ - // const orderBy = 'abc123' - - // Imports the Privateca library - const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1beta1; - - // Instantiates a client - const privatecaClient = new CertificateAuthorityServiceClient(); - - async function callListCertificateRevocationLists() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await privatecaClient.listCertificateRevocationListsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListCertificateRevocationLists(); - // [END privateca_v1beta1_generated_CertificateAuthorityService_ListCertificateRevocationLists_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.list_certificates.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.list_certificates.js deleted file mode 100644 index 81c7c01..0000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.list_certificates.js +++ /dev/null @@ -1,88 +0,0 @@ -// 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 privateca_v1beta1_generated_CertificateAuthorityService_ListCertificates_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the location associated with the - * Certificates google.cloud.security.privateca.v1beta1.Certificate, in the format - * `projects/* /locations/* /certificateauthorities/*`. - */ - // const parent = 'abc123' - /** - * Optional. Limit on the number of - * Certificates google.cloud.security.privateca.v1beta1.Certificate to include in the - * response. Further Certificates google.cloud.security.privateca.v1beta1.Certificate can subsequently be obtained - * by including the - * ListCertificatesResponse.next_page_token google.cloud.security.privateca.v1beta1.ListCertificatesResponse.next_page_token in a subsequent - * request. If unspecified, the server will pick an appropriate default. - */ - // const pageSize = 1234 - /** - * Optional. Pagination token, returned earlier via - * ListCertificatesResponse.next_page_token google.cloud.security.privateca.v1beta1.ListCertificatesResponse.next_page_token. - */ - // const pageToken = 'abc123' - /** - * Optional. Only include resources that match the filter in the response. For details - * on supported filters and syntax, see Certificates Filtering - * documentation (https://cloud.google.com/certificate-authority-service/docs/sorting-filtering-certificates#filtering_support). - */ - // const filter = 'abc123' - /** - * Optional. Specify how the results should be sorted. For details on supported fields - * and syntax, see Certificates Sorting - * documentation (https://cloud.google.com/certificate-authority-service/docs/sorting-filtering-certificates#sorting_support). - */ - // const orderBy = 'abc123' - - // Imports the Privateca library - const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1beta1; - - // Instantiates a client - const privatecaClient = new CertificateAuthorityServiceClient(); - - async function callListCertificates() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await privatecaClient.listCertificatesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListCertificates(); - // [END privateca_v1beta1_generated_CertificateAuthorityService_ListCertificates_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.list_reusable_configs.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.list_reusable_configs.js deleted file mode 100644 index 479948d..0000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.list_reusable_configs.js +++ /dev/null @@ -1,84 +0,0 @@ -// 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 privateca_v1beta1_generated_CertificateAuthorityService_ListReusableConfigs_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the location associated with the - * ReusableConfigs google.cloud.security.privateca.v1beta1.ReusableConfig, in the format - * `projects/* /locations/*`. - */ - // const parent = 'abc123' - /** - * Optional. Limit on the number of - * ReusableConfigs google.cloud.security.privateca.v1beta1.ReusableConfig to include in the response. - * Further ReusableConfigs google.cloud.security.privateca.v1beta1.ReusableConfig can subsequently be - * obtained by including the - * ListReusableConfigsResponse.next_page_token google.cloud.security.privateca.v1beta1.ListReusableConfigsResponse.next_page_token in a subsequent request. If - * unspecified, the server will pick an appropriate default. - */ - // const pageSize = 1234 - /** - * Optional. Pagination token, returned earlier via - * ListReusableConfigsResponse.next_page_token google.cloud.security.privateca.v1beta1.ListReusableConfigsResponse.next_page_token. - */ - // const pageToken = 'abc123' - /** - * Optional. Only include resources that match the filter in the response. - */ - // const filter = 'abc123' - /** - * Optional. Specify how the results should be sorted. - */ - // const orderBy = 'abc123' - - // Imports the Privateca library - const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1beta1; - - // Instantiates a client - const privatecaClient = new CertificateAuthorityServiceClient(); - - async function callListReusableConfigs() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await privatecaClient.listReusableConfigsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListReusableConfigs(); - // [END privateca_v1beta1_generated_CertificateAuthorityService_ListReusableConfigs_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.restore_certificate_authority.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.restore_certificate_authority.js deleted file mode 100644 index a6191a2..0000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.restore_certificate_authority.js +++ /dev/null @@ -1,74 +0,0 @@ -// 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 privateca_v1beta1_generated_CertificateAuthorityService_RestoreCertificateAuthority_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name for this CertificateAuthority google.cloud.security.privateca.v1beta1.CertificateAuthority in the - * format `projects/* /locations/* /certificateAuthorities/*`. - */ - // const name = 'abc123' - /** - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Privateca library - const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1beta1; - - // Instantiates a client - const privatecaClient = new CertificateAuthorityServiceClient(); - - async function callRestoreCertificateAuthority() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await privatecaClient.restoreCertificateAuthority(request); - const [response] = await operation.promise(); - console.log(response); - } - - callRestoreCertificateAuthority(); - // [END privateca_v1beta1_generated_CertificateAuthorityService_RestoreCertificateAuthority_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.revoke_certificate.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.revoke_certificate.js deleted file mode 100644 index de0e716..0000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.revoke_certificate.js +++ /dev/null @@ -1,78 +0,0 @@ -// 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, reason) { - // [START privateca_v1beta1_generated_CertificateAuthorityService_RevokeCertificate_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name for this Certificate google.cloud.security.privateca.v1beta1.Certificate in the - * format `projects/* /locations/* /certificateAuthorities/* /certificates/*`. - */ - // const name = 'abc123' - /** - * Required. The RevocationReason google.cloud.security.privateca.v1beta1.RevocationReason for revoking this certificate. - */ - // const reason = {} - /** - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Privateca library - const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1beta1; - - // Instantiates a client - const privatecaClient = new CertificateAuthorityServiceClient(); - - async function callRevokeCertificate() { - // Construct request - const request = { - name, - reason, - }; - - // Run request - const response = await privatecaClient.revokeCertificate(request); - console.log(response); - } - - callRevokeCertificate(); - // [END privateca_v1beta1_generated_CertificateAuthorityService_RevokeCertificate_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.schedule_delete_certificate_authority.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.schedule_delete_certificate_authority.js deleted file mode 100644 index 22379e2..0000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.schedule_delete_certificate_authority.js +++ /dev/null @@ -1,74 +0,0 @@ -// 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 privateca_v1beta1_generated_CertificateAuthorityService_ScheduleDeleteCertificateAuthority_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name for this CertificateAuthority google.cloud.security.privateca.v1beta1.CertificateAuthority in the - * format `projects/* /locations/* /certificateAuthorities/*`. - */ - // const name = 'abc123' - /** - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Privateca library - const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1beta1; - - // Instantiates a client - const privatecaClient = new CertificateAuthorityServiceClient(); - - async function callScheduleDeleteCertificateAuthority() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await privatecaClient.scheduleDeleteCertificateAuthority(request); - const [response] = await operation.promise(); - console.log(response); - } - - callScheduleDeleteCertificateAuthority(); - // [END privateca_v1beta1_generated_CertificateAuthorityService_ScheduleDeleteCertificateAuthority_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.update_certificate.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.update_certificate.js deleted file mode 100644 index faa3660..0000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.update_certificate.js +++ /dev/null @@ -1,77 +0,0 @@ -// 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(certificate, updateMask) { - // [START privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificate_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Certificate google.cloud.security.privateca.v1beta1.Certificate with updated values. - */ - // const certificate = {} - /** - * Required. A list of fields to be updated in this request. - */ - // const updateMask = {} - /** - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Privateca library - const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1beta1; - - // Instantiates a client - const privatecaClient = new CertificateAuthorityServiceClient(); - - async function callUpdateCertificate() { - // Construct request - const request = { - certificate, - updateMask, - }; - - // Run request - const response = await privatecaClient.updateCertificate(request); - console.log(response); - } - - callUpdateCertificate(); - // [END privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificate_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.update_certificate_authority.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.update_certificate_authority.js deleted file mode 100644 index bc47053..0000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.update_certificate_authority.js +++ /dev/null @@ -1,78 +0,0 @@ -// 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(certificateAuthority, updateMask) { - // [START privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificateAuthority_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. CertificateAuthority google.cloud.security.privateca.v1beta1.CertificateAuthority with updated values. - */ - // const certificateAuthority = {} - /** - * Required. A list of fields to be updated in this request. - */ - // const updateMask = {} - /** - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Privateca library - const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1beta1; - - // Instantiates a client - const privatecaClient = new CertificateAuthorityServiceClient(); - - async function callUpdateCertificateAuthority() { - // Construct request - const request = { - certificateAuthority, - updateMask, - }; - - // Run request - const [operation] = await privatecaClient.updateCertificateAuthority(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateCertificateAuthority(); - // [END privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificateAuthority_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.update_certificate_revocation_list.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.update_certificate_revocation_list.js deleted file mode 100644 index 44d5edb..0000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/certificate_authority_service.update_certificate_revocation_list.js +++ /dev/null @@ -1,78 +0,0 @@ -// 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(certificateRevocationList, updateMask) { - // [START privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificateRevocationList_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. CertificateRevocationList google.cloud.security.privateca.v1beta1.CertificateRevocationList with updated values. - */ - // const certificateRevocationList = {} - /** - * Required. A list of fields to be updated in this request. - */ - // const updateMask = {} - /** - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Privateca library - const {CertificateAuthorityServiceClient} = require('@google-cloud/security-private-ca').v1beta1; - - // Instantiates a client - const privatecaClient = new CertificateAuthorityServiceClient(); - - async function callUpdateCertificateRevocationList() { - // Construct request - const request = { - certificateRevocationList, - updateMask, - }; - - // Run request - const [operation] = await privatecaClient.updateCertificateRevocationList(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateCertificateRevocationList(); - // [END privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificateRevocationList_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.security.privateca.v1beta1.json b/owl-bot-staging/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.security.privateca.v1beta1.json deleted file mode 100644 index d9d2e45..0000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.security.privateca.v1beta1.json +++ /dev/null @@ -1,963 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-privateca", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.security.privateca.v1beta1", - "version": "v1beta1" - } - ] - }, - "snippets": [ - { - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_CreateCertificate_async", - "title": "CertificateAuthorityService createCertificate Sample", - "origin": "API_DEFINITION", - "description": " Create a new [Certificate][google.cloud.security.privateca.v1beta1.Certificate] in a given Project, Location from a particular [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority].", - "canonical": true, - "file": "certificate_authority_service.create_certificate.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateCertificate", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.CreateCertificate", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "certificate_id", - "type": "TYPE_STRING" - }, - { - "name": "certificate", - "type": ".google.cloud.security.privateca.v1beta1.Certificate" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.security.privateca.v1beta1.Certificate", - "client": { - "shortName": "CertificateAuthorityServiceClient", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient" - }, - "method": { - "shortName": "CreateCertificate", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.CreateCertificate", - "service": { - "shortName": "CertificateAuthorityService", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService" - } - } - } - }, - { - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_GetCertificate_async", - "title": "CertificateAuthorityService getCertificate Sample", - "origin": "API_DEFINITION", - "description": " Returns a [Certificate][google.cloud.security.privateca.v1beta1.Certificate].", - "canonical": true, - "file": "certificate_authority_service.get_certificate.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 50, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetCertificate", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetCertificate", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.security.privateca.v1beta1.Certificate", - "client": { - "shortName": "CertificateAuthorityServiceClient", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient" - }, - "method": { - "shortName": "GetCertificate", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetCertificate", - "service": { - "shortName": "CertificateAuthorityService", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService" - } - } - } - }, - { - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_ListCertificates_async", - "title": "CertificateAuthorityService listCertificates Sample", - "origin": "API_DEFINITION", - "description": " Lists [Certificates][google.cloud.security.privateca.v1beta1.Certificate].", - "canonical": true, - "file": "certificate_authority_service.list_certificates.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 80, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListCertificates", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificates", - "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.security.privateca.v1beta1.ListCertificatesResponse", - "client": { - "shortName": "CertificateAuthorityServiceClient", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient" - }, - "method": { - "shortName": "ListCertificates", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificates", - "service": { - "shortName": "CertificateAuthorityService", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService" - } - } - } - }, - { - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_RevokeCertificate_async", - "title": "CertificateAuthorityService revokeCertificate Sample", - "origin": "API_DEFINITION", - "description": " Revoke a [Certificate][google.cloud.security.privateca.v1beta1.Certificate].", - "canonical": true, - "file": "certificate_authority_service.revoke_certificate.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RevokeCertificate", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.RevokeCertificate", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "reason", - "type": ".google.cloud.security.privateca.v1beta1.RevocationReason" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.security.privateca.v1beta1.Certificate", - "client": { - "shortName": "CertificateAuthorityServiceClient", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient" - }, - "method": { - "shortName": "RevokeCertificate", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.RevokeCertificate", - "service": { - "shortName": "CertificateAuthorityService", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService" - } - } - } - }, - { - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificate_async", - "title": "CertificateAuthorityService updateCertificate Sample", - "origin": "API_DEFINITION", - "description": " Update a [Certificate][google.cloud.security.privateca.v1beta1.Certificate]. Currently, the only field you can update is the [labels][google.cloud.security.privateca.v1beta1.Certificate.labels] field.", - "canonical": true, - "file": "certificate_authority_service.update_certificate.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateCertificate", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.UpdateCertificate", - "async": true, - "parameters": [ - { - "name": "certificate", - "type": ".google.cloud.security.privateca.v1beta1.Certificate" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.security.privateca.v1beta1.Certificate", - "client": { - "shortName": "CertificateAuthorityServiceClient", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient" - }, - "method": { - "shortName": "UpdateCertificate", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.UpdateCertificate", - "service": { - "shortName": "CertificateAuthorityService", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService" - } - } - } - }, - { - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_ActivateCertificateAuthority_async", - "title": "CertificateAuthorityService activateCertificateAuthority Sample", - "origin": "API_DEFINITION", - "description": " Activate a [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] that is in state [PENDING_ACTIVATION][google.cloud.security.privateca.v1beta1.CertificateAuthority.State.PENDING_ACTIVATION] and is of type [SUBORDINATE][google.cloud.security.privateca.v1beta1.CertificateAuthority.Type.SUBORDINATE]. After the parent Certificate Authority signs a certificate signing request from [FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.FetchCertificateAuthorityCsr], this method can complete the activation process.", - "canonical": true, - "file": "certificate_authority_service.activate_certificate_authority.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ActivateCertificateAuthority", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ActivateCertificateAuthority", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "pem_ca_certificate", - "type": "TYPE_STRING" - }, - { - "name": "subordinate_config", - "type": ".google.cloud.security.privateca.v1beta1.SubordinateConfig" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CertificateAuthorityServiceClient", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient" - }, - "method": { - "shortName": "ActivateCertificateAuthority", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ActivateCertificateAuthority", - "service": { - "shortName": "CertificateAuthorityService", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService" - } - } - } - }, - { - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_CreateCertificateAuthority_async", - "title": "CertificateAuthorityService createCertificateAuthority Sample", - "origin": "API_DEFINITION", - "description": " Create a new [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] in a given Project and Location.", - "canonical": true, - "file": "certificate_authority_service.create_certificate_authority.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateCertificateAuthority", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.CreateCertificateAuthority", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "certificate_authority_id", - "type": "TYPE_STRING" - }, - { - "name": "certificate_authority", - "type": ".google.cloud.security.privateca.v1beta1.CertificateAuthority" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CertificateAuthorityServiceClient", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient" - }, - "method": { - "shortName": "CreateCertificateAuthority", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.CreateCertificateAuthority", - "service": { - "shortName": "CertificateAuthorityService", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService" - } - } - } - }, - { - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_DisableCertificateAuthority_async", - "title": "CertificateAuthorityService disableCertificateAuthority Sample", - "origin": "API_DEFINITION", - "description": " Disable a [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority].", - "canonical": true, - "file": "certificate_authority_service.disable_certificate_authority.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DisableCertificateAuthority", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.DisableCertificateAuthority", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CertificateAuthorityServiceClient", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient" - }, - "method": { - "shortName": "DisableCertificateAuthority", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.DisableCertificateAuthority", - "service": { - "shortName": "CertificateAuthorityService", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService" - } - } - } - }, - { - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_EnableCertificateAuthority_async", - "title": "CertificateAuthorityService enableCertificateAuthority Sample", - "origin": "API_DEFINITION", - "description": " Enable a [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority].", - "canonical": true, - "file": "certificate_authority_service.enable_certificate_authority.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "EnableCertificateAuthority", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.EnableCertificateAuthority", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CertificateAuthorityServiceClient", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient" - }, - "method": { - "shortName": "EnableCertificateAuthority", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.EnableCertificateAuthority", - "service": { - "shortName": "CertificateAuthorityService", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService" - } - } - } - }, - { - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_FetchCertificateAuthorityCsr_async", - "title": "CertificateAuthorityService fetchCertificateAuthorityCsr Sample", - "origin": "API_DEFINITION", - "description": " Fetch a certificate signing request (CSR) from a [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] that is in state [PENDING_ACTIVATION][google.cloud.security.privateca.v1beta1.CertificateAuthority.State.PENDING_ACTIVATION] and is of type [SUBORDINATE][google.cloud.security.privateca.v1beta1.CertificateAuthority.Type.SUBORDINATE]. The CSR must then be signed by the desired parent Certificate Authority, which could be another [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] resource, or could be an on-prem certificate authority. See also [ActivateCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ActivateCertificateAuthority].", - "canonical": true, - "file": "certificate_authority_service.fetch_certificate_authority_csr.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "FetchCertificateAuthorityCsr", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.FetchCertificateAuthorityCsr", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.security.privateca.v1beta1.FetchCertificateAuthorityCsrResponse", - "client": { - "shortName": "CertificateAuthorityServiceClient", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient" - }, - "method": { - "shortName": "FetchCertificateAuthorityCsr", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.FetchCertificateAuthorityCsr", - "service": { - "shortName": "CertificateAuthorityService", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService" - } - } - } - }, - { - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_GetCertificateAuthority_async", - "title": "CertificateAuthorityService getCertificateAuthority Sample", - "origin": "API_DEFINITION", - "description": " Returns a [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority].", - "canonical": true, - "file": "certificate_authority_service.get_certificate_authority.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetCertificateAuthority", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetCertificateAuthority", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.security.privateca.v1beta1.CertificateAuthority", - "client": { - "shortName": "CertificateAuthorityServiceClient", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient" - }, - "method": { - "shortName": "GetCertificateAuthority", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetCertificateAuthority", - "service": { - "shortName": "CertificateAuthorityService", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService" - } - } - } - }, - { - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_ListCertificateAuthorities_async", - "title": "CertificateAuthorityService listCertificateAuthorities Sample", - "origin": "API_DEFINITION", - "description": " Lists [CertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthority].", - "canonical": true, - "file": "certificate_authority_service.list_certificate_authorities.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 76, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListCertificateAuthorities", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificateAuthorities", - "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.security.privateca.v1beta1.ListCertificateAuthoritiesResponse", - "client": { - "shortName": "CertificateAuthorityServiceClient", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient" - }, - "method": { - "shortName": "ListCertificateAuthorities", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificateAuthorities", - "service": { - "shortName": "CertificateAuthorityService", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService" - } - } - } - }, - { - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_RestoreCertificateAuthority_async", - "title": "CertificateAuthorityService restoreCertificateAuthority Sample", - "origin": "API_DEFINITION", - "description": " Restore a [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] that is scheduled for deletion.", - "canonical": true, - "file": "certificate_authority_service.restore_certificate_authority.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RestoreCertificateAuthority", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.RestoreCertificateAuthority", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CertificateAuthorityServiceClient", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient" - }, - "method": { - "shortName": "RestoreCertificateAuthority", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.RestoreCertificateAuthority", - "service": { - "shortName": "CertificateAuthorityService", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService" - } - } - } - }, - { - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_ScheduleDeleteCertificateAuthority_async", - "title": "CertificateAuthorityService scheduleDeleteCertificateAuthority Sample", - "origin": "API_DEFINITION", - "description": " Schedule a [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] for deletion.", - "canonical": true, - "file": "certificate_authority_service.schedule_delete_certificate_authority.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ScheduleDeleteCertificateAuthority", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ScheduleDeleteCertificateAuthority", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CertificateAuthorityServiceClient", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient" - }, - "method": { - "shortName": "ScheduleDeleteCertificateAuthority", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ScheduleDeleteCertificateAuthority", - "service": { - "shortName": "CertificateAuthorityService", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService" - } - } - } - }, - { - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificateAuthority_async", - "title": "CertificateAuthorityService updateCertificateAuthority Sample", - "origin": "API_DEFINITION", - "description": " Update a [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority].", - "canonical": true, - "file": "certificate_authority_service.update_certificate_authority.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateCertificateAuthority", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.UpdateCertificateAuthority", - "async": true, - "parameters": [ - { - "name": "certificate_authority", - "type": ".google.cloud.security.privateca.v1beta1.CertificateAuthority" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CertificateAuthorityServiceClient", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient" - }, - "method": { - "shortName": "UpdateCertificateAuthority", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.UpdateCertificateAuthority", - "service": { - "shortName": "CertificateAuthorityService", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService" - } - } - } - }, - { - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_GetCertificateRevocationList_async", - "title": "CertificateAuthorityService getCertificateRevocationList Sample", - "origin": "API_DEFINITION", - "description": " Returns a [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList].", - "canonical": true, - "file": "certificate_authority_service.get_certificate_revocation_list.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetCertificateRevocationList", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetCertificateRevocationList", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.security.privateca.v1beta1.CertificateRevocationList", - "client": { - "shortName": "CertificateAuthorityServiceClient", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient" - }, - "method": { - "shortName": "GetCertificateRevocationList", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetCertificateRevocationList", - "service": { - "shortName": "CertificateAuthorityService", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService" - } - } - } - }, - { - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_ListCertificateRevocationLists_async", - "title": "CertificateAuthorityService listCertificateRevocationLists Sample", - "origin": "API_DEFINITION", - "description": " Lists [CertificateRevocationLists][google.cloud.security.privateca.v1beta1.CertificateRevocationList].", - "canonical": true, - "file": "certificate_authority_service.list_certificate_revocation_lists.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 76, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListCertificateRevocationLists", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificateRevocationLists", - "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.security.privateca.v1beta1.ListCertificateRevocationListsResponse", - "client": { - "shortName": "CertificateAuthorityServiceClient", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient" - }, - "method": { - "shortName": "ListCertificateRevocationLists", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificateRevocationLists", - "service": { - "shortName": "CertificateAuthorityService", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService" - } - } - } - }, - { - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificateRevocationList_async", - "title": "CertificateAuthorityService updateCertificateRevocationList Sample", - "origin": "API_DEFINITION", - "description": " Update a [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList].", - "canonical": true, - "file": "certificate_authority_service.update_certificate_revocation_list.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateCertificateRevocationList", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.UpdateCertificateRevocationList", - "async": true, - "parameters": [ - { - "name": "certificate_revocation_list", - "type": ".google.cloud.security.privateca.v1beta1.CertificateRevocationList" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CertificateAuthorityServiceClient", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient" - }, - "method": { - "shortName": "UpdateCertificateRevocationList", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.UpdateCertificateRevocationList", - "service": { - "shortName": "CertificateAuthorityService", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService" - } - } - } - }, - { - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_GetReusableConfig_async", - "title": "CertificateAuthorityService getReusableConfig Sample", - "origin": "API_DEFINITION", - "description": " Returns a [ReusableConfig][google.cloud.security.privateca.v1beta1.ReusableConfig].", - "canonical": true, - "file": "certificate_authority_service.get_reusable_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 50, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetReusableConfig", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetReusableConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.security.privateca.v1beta1.ReusableConfig", - "client": { - "shortName": "CertificateAuthorityServiceClient", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient" - }, - "method": { - "shortName": "GetReusableConfig", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetReusableConfig", - "service": { - "shortName": "CertificateAuthorityService", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService" - } - } - } - }, - { - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_ListReusableConfigs_async", - "title": "CertificateAuthorityService listReusableConfigs Sample", - "origin": "API_DEFINITION", - "description": " Lists [ReusableConfigs][google.cloud.security.privateca.v1beta1.ReusableConfig].", - "canonical": true, - "file": "certificate_authority_service.list_reusable_configs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 76, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListReusableConfigs", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListReusableConfigs", - "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.security.privateca.v1beta1.ListReusableConfigsResponse", - "client": { - "shortName": "CertificateAuthorityServiceClient", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient" - }, - "method": { - "shortName": "ListReusableConfigs", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListReusableConfigs", - "service": { - "shortName": "CertificateAuthorityService", - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService" - } - } - } - } - ] -} diff --git a/owl-bot-staging/v1beta1/src/index.ts b/owl-bot-staging/v1beta1/src/index.ts deleted file mode 100644 index 915ad84..0000000 --- a/owl-bot-staging/v1beta1/src/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -// 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 v1beta1 from './v1beta1'; -const CertificateAuthorityServiceClient = v1beta1.CertificateAuthorityServiceClient; -type CertificateAuthorityServiceClient = v1beta1.CertificateAuthorityServiceClient; -export {v1beta1, CertificateAuthorityServiceClient}; -export default {v1beta1, CertificateAuthorityServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/v1beta1/src/v1beta1/certificate_authority_service_client.ts b/owl-bot-staging/v1beta1/src/v1beta1/certificate_authority_service_client.ts deleted file mode 100644 index 2343149..0000000 --- a/owl-bot-staging/v1beta1/src/v1beta1/certificate_authority_service_client.ts +++ /dev/null @@ -1,3027 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; - -import { Transform } from 'stream'; -import { RequestType } from 'google-gax/build/src/apitypes'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1beta1/certificate_authority_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './certificate_authority_service_client_config.json'; -import { operationsProtos } from 'google-gax'; -const version = require('../../../package.json').version; - -/** - * {@link google.cloud.security.privateca.v1beta1.CertificateAuthorityService|Certificate Authority Service} manages private - * certificate authorities and issued certificates. - * @class - * @memberof v1beta1 - */ -export class CertificateAuthorityServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - certificateAuthorityServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of CertificateAuthorityServiceClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof CertificateAuthorityServiceClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // 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 = { - certificatePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/certificateAuthorities/{certificate_authority}/certificates/{certificate}' - ), - certificateAuthorityPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/certificateAuthorities/{certificate_authority}' - ), - certificateRevocationListPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/certificateAuthorities/{certificate_authority}/certificateRevocationLists/{certificate_revocation_list}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - reusableConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/reusableConfigs/{reusable_config}' - ), - }; - - // Some of the methods on this service return "paged" results, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listCertificates: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'certificates'), - listCertificateAuthorities: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'certificateAuthorities'), - listCertificateRevocationLists: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'certificateRevocationLists'), - listReusableConfigs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'reusableConfigs') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = []; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const activateCertificateAuthorityResponse = protoFilesRoot.lookup( - '.google.cloud.security.privateca.v1beta1.CertificateAuthority') as gax.protobuf.Type; - const activateCertificateAuthorityMetadata = protoFilesRoot.lookup( - '.google.cloud.security.privateca.v1beta1.OperationMetadata') as gax.protobuf.Type; - const createCertificateAuthorityResponse = protoFilesRoot.lookup( - '.google.cloud.security.privateca.v1beta1.CertificateAuthority') as gax.protobuf.Type; - const createCertificateAuthorityMetadata = protoFilesRoot.lookup( - '.google.cloud.security.privateca.v1beta1.OperationMetadata') as gax.protobuf.Type; - const disableCertificateAuthorityResponse = protoFilesRoot.lookup( - '.google.cloud.security.privateca.v1beta1.CertificateAuthority') as gax.protobuf.Type; - const disableCertificateAuthorityMetadata = protoFilesRoot.lookup( - '.google.cloud.security.privateca.v1beta1.OperationMetadata') as gax.protobuf.Type; - const enableCertificateAuthorityResponse = protoFilesRoot.lookup( - '.google.cloud.security.privateca.v1beta1.CertificateAuthority') as gax.protobuf.Type; - const enableCertificateAuthorityMetadata = protoFilesRoot.lookup( - '.google.cloud.security.privateca.v1beta1.OperationMetadata') as gax.protobuf.Type; - const restoreCertificateAuthorityResponse = protoFilesRoot.lookup( - '.google.cloud.security.privateca.v1beta1.CertificateAuthority') as gax.protobuf.Type; - const restoreCertificateAuthorityMetadata = protoFilesRoot.lookup( - '.google.cloud.security.privateca.v1beta1.OperationMetadata') as gax.protobuf.Type; - const scheduleDeleteCertificateAuthorityResponse = protoFilesRoot.lookup( - '.google.cloud.security.privateca.v1beta1.CertificateAuthority') as gax.protobuf.Type; - const scheduleDeleteCertificateAuthorityMetadata = protoFilesRoot.lookup( - '.google.cloud.security.privateca.v1beta1.OperationMetadata') as gax.protobuf.Type; - const updateCertificateAuthorityResponse = protoFilesRoot.lookup( - '.google.cloud.security.privateca.v1beta1.CertificateAuthority') as gax.protobuf.Type; - const updateCertificateAuthorityMetadata = protoFilesRoot.lookup( - '.google.cloud.security.privateca.v1beta1.OperationMetadata') as gax.protobuf.Type; - const updateCertificateRevocationListResponse = protoFilesRoot.lookup( - '.google.cloud.security.privateca.v1beta1.CertificateRevocationList') as gax.protobuf.Type; - const updateCertificateRevocationListMetadata = protoFilesRoot.lookup( - '.google.cloud.security.privateca.v1beta1.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - activateCertificateAuthority: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - activateCertificateAuthorityResponse.decode.bind(activateCertificateAuthorityResponse), - activateCertificateAuthorityMetadata.decode.bind(activateCertificateAuthorityMetadata)), - createCertificateAuthority: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createCertificateAuthorityResponse.decode.bind(createCertificateAuthorityResponse), - createCertificateAuthorityMetadata.decode.bind(createCertificateAuthorityMetadata)), - disableCertificateAuthority: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - disableCertificateAuthorityResponse.decode.bind(disableCertificateAuthorityResponse), - disableCertificateAuthorityMetadata.decode.bind(disableCertificateAuthorityMetadata)), - enableCertificateAuthority: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - enableCertificateAuthorityResponse.decode.bind(enableCertificateAuthorityResponse), - enableCertificateAuthorityMetadata.decode.bind(enableCertificateAuthorityMetadata)), - restoreCertificateAuthority: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - restoreCertificateAuthorityResponse.decode.bind(restoreCertificateAuthorityResponse), - restoreCertificateAuthorityMetadata.decode.bind(restoreCertificateAuthorityMetadata)), - scheduleDeleteCertificateAuthority: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - scheduleDeleteCertificateAuthorityResponse.decode.bind(scheduleDeleteCertificateAuthorityResponse), - scheduleDeleteCertificateAuthorityMetadata.decode.bind(scheduleDeleteCertificateAuthorityMetadata)), - updateCertificateAuthority: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateCertificateAuthorityResponse.decode.bind(updateCertificateAuthorityResponse), - updateCertificateAuthorityMetadata.decode.bind(updateCertificateAuthorityMetadata)), - updateCertificateRevocationList: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateCertificateRevocationListResponse.decode.bind(updateCertificateRevocationListResponse), - updateCertificateRevocationListMetadata.decode.bind(updateCertificateRevocationListMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.security.privateca.v1beta1.CertificateAuthorityService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.certificateAuthorityServiceStub) { - return this.certificateAuthorityServiceStub; - } - - // Put together the "service stub" for - // google.cloud.security.privateca.v1beta1.CertificateAuthorityService. - this.certificateAuthorityServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.security.privateca.v1beta1.CertificateAuthorityService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.security.privateca.v1beta1.CertificateAuthorityService, - 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 certificateAuthorityServiceStubMethods = - ['createCertificate', 'getCertificate', 'listCertificates', 'revokeCertificate', 'updateCertificate', 'activateCertificateAuthority', 'createCertificateAuthority', 'disableCertificateAuthority', 'enableCertificateAuthority', 'fetchCertificateAuthorityCsr', 'getCertificateAuthority', 'listCertificateAuthorities', 'restoreCertificateAuthority', 'scheduleDeleteCertificateAuthority', 'updateCertificateAuthority', 'getCertificateRevocationList', 'listCertificateRevocationLists', 'updateCertificateRevocationList', 'getReusableConfig', 'listReusableConfigs']; - for (const methodName of certificateAuthorityServiceStubMethods) { - const callPromise = this.certificateAuthorityServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.certificateAuthorityServiceStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'privateca.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 'privateca.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Create a new {@link google.cloud.security.privateca.v1beta1.Certificate|Certificate} in a given Project, Location from a particular - * {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthority}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the location and {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthority} - * associated with the {@link google.cloud.security.privateca.v1beta1.Certificate|Certificate}, in the format - * `projects/* /locations/* /certificateAuthorities/*`. - * @param {string} [request.certificateId] - * Optional. It must be unique within a location and match the regular - * expression `[a-zA-Z0-9_-]{1,63}`. This field is required when using a - * {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthority} in the Enterprise {@link google.cloud.security.privateca.v1beta1.CertificateAuthority.Tier|CertificateAuthority.Tier}, - * but is optional and its value is ignored otherwise. - * @param {google.cloud.security.privateca.v1beta1.Certificate} request.certificate - * Required. A {@link google.cloud.security.privateca.v1beta1.Certificate|Certificate} with initial field values. - * @param {string} [request.requestId] - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [Certificate]{@link google.cloud.security.privateca.v1beta1.Certificate}. - * 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/v1beta1/certificate_authority_service.create_certificate.js - * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_CreateCertificate_async - */ - createCertificate( - request?: protos.google.cloud.security.privateca.v1beta1.ICreateCertificateRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.security.privateca.v1beta1.ICertificate, - protos.google.cloud.security.privateca.v1beta1.ICreateCertificateRequest|undefined, {}|undefined - ]>; - createCertificate( - request: protos.google.cloud.security.privateca.v1beta1.ICreateCertificateRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.security.privateca.v1beta1.ICertificate, - protos.google.cloud.security.privateca.v1beta1.ICreateCertificateRequest|null|undefined, - {}|null|undefined>): void; - createCertificate( - request: protos.google.cloud.security.privateca.v1beta1.ICreateCertificateRequest, - callback: Callback< - protos.google.cloud.security.privateca.v1beta1.ICertificate, - protos.google.cloud.security.privateca.v1beta1.ICreateCertificateRequest|null|undefined, - {}|null|undefined>): void; - createCertificate( - request?: protos.google.cloud.security.privateca.v1beta1.ICreateCertificateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.security.privateca.v1beta1.ICertificate, - protos.google.cloud.security.privateca.v1beta1.ICreateCertificateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.security.privateca.v1beta1.ICertificate, - protos.google.cloud.security.privateca.v1beta1.ICreateCertificateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.security.privateca.v1beta1.ICertificate, - protos.google.cloud.security.privateca.v1beta1.ICreateCertificateRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createCertificate(request, options, callback); - } -/** - * Returns a {@link google.cloud.security.privateca.v1beta1.Certificate|Certificate}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The {@link google.cloud.security.privateca.v1beta1.Certificate.name|name} of the {@link google.cloud.security.privateca.v1beta1.Certificate|Certificate} 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 [Certificate]{@link google.cloud.security.privateca.v1beta1.Certificate}. - * 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/v1beta1/certificate_authority_service.get_certificate.js - * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_GetCertificate_async - */ - getCertificate( - request?: protos.google.cloud.security.privateca.v1beta1.IGetCertificateRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.security.privateca.v1beta1.ICertificate, - protos.google.cloud.security.privateca.v1beta1.IGetCertificateRequest|undefined, {}|undefined - ]>; - getCertificate( - request: protos.google.cloud.security.privateca.v1beta1.IGetCertificateRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.security.privateca.v1beta1.ICertificate, - protos.google.cloud.security.privateca.v1beta1.IGetCertificateRequest|null|undefined, - {}|null|undefined>): void; - getCertificate( - request: protos.google.cloud.security.privateca.v1beta1.IGetCertificateRequest, - callback: Callback< - protos.google.cloud.security.privateca.v1beta1.ICertificate, - protos.google.cloud.security.privateca.v1beta1.IGetCertificateRequest|null|undefined, - {}|null|undefined>): void; - getCertificate( - request?: protos.google.cloud.security.privateca.v1beta1.IGetCertificateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.security.privateca.v1beta1.ICertificate, - protos.google.cloud.security.privateca.v1beta1.IGetCertificateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.security.privateca.v1beta1.ICertificate, - protos.google.cloud.security.privateca.v1beta1.IGetCertificateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.security.privateca.v1beta1.ICertificate, - protos.google.cloud.security.privateca.v1beta1.IGetCertificateRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getCertificate(request, options, callback); - } -/** - * Revoke a {@link google.cloud.security.privateca.v1beta1.Certificate|Certificate}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name for this {@link google.cloud.security.privateca.v1beta1.Certificate|Certificate} in the - * format `projects/* /locations/* /certificateAuthorities/* /certificates/*`. - * @param {google.cloud.security.privateca.v1beta1.RevocationReason} request.reason - * Required. The {@link google.cloud.security.privateca.v1beta1.RevocationReason|RevocationReason} for revoking this certificate. - * @param {string} [request.requestId] - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [Certificate]{@link google.cloud.security.privateca.v1beta1.Certificate}. - * 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/v1beta1/certificate_authority_service.revoke_certificate.js - * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_RevokeCertificate_async - */ - revokeCertificate( - request?: protos.google.cloud.security.privateca.v1beta1.IRevokeCertificateRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.security.privateca.v1beta1.ICertificate, - protos.google.cloud.security.privateca.v1beta1.IRevokeCertificateRequest|undefined, {}|undefined - ]>; - revokeCertificate( - request: protos.google.cloud.security.privateca.v1beta1.IRevokeCertificateRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.security.privateca.v1beta1.ICertificate, - protos.google.cloud.security.privateca.v1beta1.IRevokeCertificateRequest|null|undefined, - {}|null|undefined>): void; - revokeCertificate( - request: protos.google.cloud.security.privateca.v1beta1.IRevokeCertificateRequest, - callback: Callback< - protos.google.cloud.security.privateca.v1beta1.ICertificate, - protos.google.cloud.security.privateca.v1beta1.IRevokeCertificateRequest|null|undefined, - {}|null|undefined>): void; - revokeCertificate( - request?: protos.google.cloud.security.privateca.v1beta1.IRevokeCertificateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.security.privateca.v1beta1.ICertificate, - protos.google.cloud.security.privateca.v1beta1.IRevokeCertificateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.security.privateca.v1beta1.ICertificate, - protos.google.cloud.security.privateca.v1beta1.IRevokeCertificateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.security.privateca.v1beta1.ICertificate, - protos.google.cloud.security.privateca.v1beta1.IRevokeCertificateRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.revokeCertificate(request, options, callback); - } -/** - * Update a {@link google.cloud.security.privateca.v1beta1.Certificate|Certificate}. Currently, the only field you can update is the - * {@link google.cloud.security.privateca.v1beta1.Certificate.labels|labels} field. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.security.privateca.v1beta1.Certificate} request.certificate - * Required. {@link google.cloud.security.privateca.v1beta1.Certificate|Certificate} with updated values. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. A list of fields to be updated in this request. - * @param {string} [request.requestId] - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [Certificate]{@link google.cloud.security.privateca.v1beta1.Certificate}. - * 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/v1beta1/certificate_authority_service.update_certificate.js - * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificate_async - */ - updateCertificate( - request?: protos.google.cloud.security.privateca.v1beta1.IUpdateCertificateRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.security.privateca.v1beta1.ICertificate, - protos.google.cloud.security.privateca.v1beta1.IUpdateCertificateRequest|undefined, {}|undefined - ]>; - updateCertificate( - request: protos.google.cloud.security.privateca.v1beta1.IUpdateCertificateRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.security.privateca.v1beta1.ICertificate, - protos.google.cloud.security.privateca.v1beta1.IUpdateCertificateRequest|null|undefined, - {}|null|undefined>): void; - updateCertificate( - request: protos.google.cloud.security.privateca.v1beta1.IUpdateCertificateRequest, - callback: Callback< - protos.google.cloud.security.privateca.v1beta1.ICertificate, - protos.google.cloud.security.privateca.v1beta1.IUpdateCertificateRequest|null|undefined, - {}|null|undefined>): void; - updateCertificate( - request?: protos.google.cloud.security.privateca.v1beta1.IUpdateCertificateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.security.privateca.v1beta1.ICertificate, - protos.google.cloud.security.privateca.v1beta1.IUpdateCertificateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.security.privateca.v1beta1.ICertificate, - protos.google.cloud.security.privateca.v1beta1.IUpdateCertificateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.security.privateca.v1beta1.ICertificate, - protos.google.cloud.security.privateca.v1beta1.IUpdateCertificateRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'certificate.name': request.certificate!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateCertificate(request, options, callback); - } -/** - * Fetch a certificate signing request (CSR) from a {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthority} - * that is in state - * {@link google.cloud.security.privateca.v1beta1.CertificateAuthority.State.PENDING_ACTIVATION|PENDING_ACTIVATION} and is - * of type {@link google.cloud.security.privateca.v1beta1.CertificateAuthority.Type.SUBORDINATE|SUBORDINATE}. The CSR must - * then be signed by the desired parent Certificate Authority, which could be - * another {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthority} resource, or could be an on-prem - * certificate authority. See also {@link google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ActivateCertificateAuthority|ActivateCertificateAuthority}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name for this {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthority} in the - * format `projects/* /locations/* /certificateAuthorities/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [FetchCertificateAuthorityCsrResponse]{@link google.cloud.security.privateca.v1beta1.FetchCertificateAuthorityCsrResponse}. - * 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/v1beta1/certificate_authority_service.fetch_certificate_authority_csr.js - * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_FetchCertificateAuthorityCsr_async - */ - fetchCertificateAuthorityCsr( - request?: protos.google.cloud.security.privateca.v1beta1.IFetchCertificateAuthorityCsrRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.security.privateca.v1beta1.IFetchCertificateAuthorityCsrResponse, - protos.google.cloud.security.privateca.v1beta1.IFetchCertificateAuthorityCsrRequest|undefined, {}|undefined - ]>; - fetchCertificateAuthorityCsr( - request: protos.google.cloud.security.privateca.v1beta1.IFetchCertificateAuthorityCsrRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.security.privateca.v1beta1.IFetchCertificateAuthorityCsrResponse, - protos.google.cloud.security.privateca.v1beta1.IFetchCertificateAuthorityCsrRequest|null|undefined, - {}|null|undefined>): void; - fetchCertificateAuthorityCsr( - request: protos.google.cloud.security.privateca.v1beta1.IFetchCertificateAuthorityCsrRequest, - callback: Callback< - protos.google.cloud.security.privateca.v1beta1.IFetchCertificateAuthorityCsrResponse, - protos.google.cloud.security.privateca.v1beta1.IFetchCertificateAuthorityCsrRequest|null|undefined, - {}|null|undefined>): void; - fetchCertificateAuthorityCsr( - request?: protos.google.cloud.security.privateca.v1beta1.IFetchCertificateAuthorityCsrRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.security.privateca.v1beta1.IFetchCertificateAuthorityCsrResponse, - protos.google.cloud.security.privateca.v1beta1.IFetchCertificateAuthorityCsrRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.security.privateca.v1beta1.IFetchCertificateAuthorityCsrResponse, - protos.google.cloud.security.privateca.v1beta1.IFetchCertificateAuthorityCsrRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.security.privateca.v1beta1.IFetchCertificateAuthorityCsrResponse, - protos.google.cloud.security.privateca.v1beta1.IFetchCertificateAuthorityCsrRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.fetchCertificateAuthorityCsr(request, options, callback); - } -/** - * Returns a {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthority}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The {@link google.cloud.security.privateca.v1beta1.CertificateAuthority.name|name} of the {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthority} 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 [CertificateAuthority]{@link google.cloud.security.privateca.v1beta1.CertificateAuthority}. - * 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/v1beta1/certificate_authority_service.get_certificate_authority.js - * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_GetCertificateAuthority_async - */ - getCertificateAuthority( - request?: protos.google.cloud.security.privateca.v1beta1.IGetCertificateAuthorityRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.security.privateca.v1beta1.ICertificateAuthority, - protos.google.cloud.security.privateca.v1beta1.IGetCertificateAuthorityRequest|undefined, {}|undefined - ]>; - getCertificateAuthority( - request: protos.google.cloud.security.privateca.v1beta1.IGetCertificateAuthorityRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.security.privateca.v1beta1.ICertificateAuthority, - protos.google.cloud.security.privateca.v1beta1.IGetCertificateAuthorityRequest|null|undefined, - {}|null|undefined>): void; - getCertificateAuthority( - request: protos.google.cloud.security.privateca.v1beta1.IGetCertificateAuthorityRequest, - callback: Callback< - protos.google.cloud.security.privateca.v1beta1.ICertificateAuthority, - protos.google.cloud.security.privateca.v1beta1.IGetCertificateAuthorityRequest|null|undefined, - {}|null|undefined>): void; - getCertificateAuthority( - request?: protos.google.cloud.security.privateca.v1beta1.IGetCertificateAuthorityRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.security.privateca.v1beta1.ICertificateAuthority, - protos.google.cloud.security.privateca.v1beta1.IGetCertificateAuthorityRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.security.privateca.v1beta1.ICertificateAuthority, - protos.google.cloud.security.privateca.v1beta1.IGetCertificateAuthorityRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.security.privateca.v1beta1.ICertificateAuthority, - protos.google.cloud.security.privateca.v1beta1.IGetCertificateAuthorityRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getCertificateAuthority(request, options, callback); - } -/** - * Returns a {@link google.cloud.security.privateca.v1beta1.CertificateRevocationList|CertificateRevocationList}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The {@link google.cloud.security.privateca.v1beta1.CertificateRevocationList.name|name} of the - * {@link google.cloud.security.privateca.v1beta1.CertificateRevocationList|CertificateRevocationList} 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 [CertificateRevocationList]{@link google.cloud.security.privateca.v1beta1.CertificateRevocationList}. - * 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/v1beta1/certificate_authority_service.get_certificate_revocation_list.js - * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_GetCertificateRevocationList_async - */ - getCertificateRevocationList( - request?: protos.google.cloud.security.privateca.v1beta1.IGetCertificateRevocationListRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.security.privateca.v1beta1.ICertificateRevocationList, - protos.google.cloud.security.privateca.v1beta1.IGetCertificateRevocationListRequest|undefined, {}|undefined - ]>; - getCertificateRevocationList( - request: protos.google.cloud.security.privateca.v1beta1.IGetCertificateRevocationListRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.security.privateca.v1beta1.ICertificateRevocationList, - protos.google.cloud.security.privateca.v1beta1.IGetCertificateRevocationListRequest|null|undefined, - {}|null|undefined>): void; - getCertificateRevocationList( - request: protos.google.cloud.security.privateca.v1beta1.IGetCertificateRevocationListRequest, - callback: Callback< - protos.google.cloud.security.privateca.v1beta1.ICertificateRevocationList, - protos.google.cloud.security.privateca.v1beta1.IGetCertificateRevocationListRequest|null|undefined, - {}|null|undefined>): void; - getCertificateRevocationList( - request?: protos.google.cloud.security.privateca.v1beta1.IGetCertificateRevocationListRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.security.privateca.v1beta1.ICertificateRevocationList, - protos.google.cloud.security.privateca.v1beta1.IGetCertificateRevocationListRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.security.privateca.v1beta1.ICertificateRevocationList, - protos.google.cloud.security.privateca.v1beta1.IGetCertificateRevocationListRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.security.privateca.v1beta1.ICertificateRevocationList, - protos.google.cloud.security.privateca.v1beta1.IGetCertificateRevocationListRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getCertificateRevocationList(request, options, callback); - } -/** - * Returns a {@link google.cloud.security.privateca.v1beta1.ReusableConfig|ReusableConfig}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The {@link ReusableConfigs.name|name} of the {@link |ReusableConfigs} 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 [ReusableConfig]{@link google.cloud.security.privateca.v1beta1.ReusableConfig}. - * 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/v1beta1/certificate_authority_service.get_reusable_config.js - * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_GetReusableConfig_async - */ - getReusableConfig( - request?: protos.google.cloud.security.privateca.v1beta1.IGetReusableConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.security.privateca.v1beta1.IReusableConfig, - protos.google.cloud.security.privateca.v1beta1.IGetReusableConfigRequest|undefined, {}|undefined - ]>; - getReusableConfig( - request: protos.google.cloud.security.privateca.v1beta1.IGetReusableConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.security.privateca.v1beta1.IReusableConfig, - protos.google.cloud.security.privateca.v1beta1.IGetReusableConfigRequest|null|undefined, - {}|null|undefined>): void; - getReusableConfig( - request: protos.google.cloud.security.privateca.v1beta1.IGetReusableConfigRequest, - callback: Callback< - protos.google.cloud.security.privateca.v1beta1.IReusableConfig, - protos.google.cloud.security.privateca.v1beta1.IGetReusableConfigRequest|null|undefined, - {}|null|undefined>): void; - getReusableConfig( - request?: protos.google.cloud.security.privateca.v1beta1.IGetReusableConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.security.privateca.v1beta1.IReusableConfig, - protos.google.cloud.security.privateca.v1beta1.IGetReusableConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.security.privateca.v1beta1.IReusableConfig, - protos.google.cloud.security.privateca.v1beta1.IGetReusableConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.security.privateca.v1beta1.IReusableConfig, - protos.google.cloud.security.privateca.v1beta1.IGetReusableConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getReusableConfig(request, options, callback); - } - -/** - * Activate a {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthority} that is in state - * {@link google.cloud.security.privateca.v1beta1.CertificateAuthority.State.PENDING_ACTIVATION|PENDING_ACTIVATION} and is - * of type {@link google.cloud.security.privateca.v1beta1.CertificateAuthority.Type.SUBORDINATE|SUBORDINATE}. After the - * parent Certificate Authority signs a certificate signing request from - * {@link google.cloud.security.privateca.v1beta1.CertificateAuthorityService.FetchCertificateAuthorityCsr|FetchCertificateAuthorityCsr}, this method can complete the activation - * process. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name for this {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthority} in the - * format `projects/* /locations/* /certificateAuthorities/*`. - * @param {string} request.pemCaCertificate - * Required. The signed CA certificate issued from - * {@link google.cloud.security.privateca.v1beta1.FetchCertificateAuthorityCsrResponse.pem_csr|FetchCertificateAuthorityCsrResponse.pem_csr}. - * @param {google.cloud.security.privateca.v1beta1.SubordinateConfig} request.subordinateConfig - * Required. Must include information about the issuer of 'pem_ca_certificate', and any - * further issuers until the self-signed CA. - * @param {string} [request.requestId] - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1beta1/certificate_authority_service.activate_certificate_authority.js - * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_ActivateCertificateAuthority_async - */ - activateCertificateAuthority( - request?: protos.google.cloud.security.privateca.v1beta1.IActivateCertificateAuthorityRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - activateCertificateAuthority( - request: protos.google.cloud.security.privateca.v1beta1.IActivateCertificateAuthorityRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - activateCertificateAuthority( - request: protos.google.cloud.security.privateca.v1beta1.IActivateCertificateAuthorityRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - activateCertificateAuthority( - request?: protos.google.cloud.security.privateca.v1beta1.IActivateCertificateAuthorityRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.activateCertificateAuthority(request, options, callback); - } -/** - * Check the status of the long running operation returned by `activateCertificateAuthority()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1beta1/certificate_authority_service.activate_certificate_authority.js - * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_ActivateCertificateAuthority_async - */ - async checkActivateCertificateAuthorityProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.activateCertificateAuthority, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Create a new {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthority} 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.security.privateca.v1beta1.CertificateAuthority|CertificateAuthorities}, in the format - * `projects/* /locations/*`. - * @param {string} request.certificateAuthorityId - * Required. It must be unique within a location and match the regular - * expression `[a-zA-Z0-9_-]{1,63}` - * @param {google.cloud.security.privateca.v1beta1.CertificateAuthority} request.certificateAuthority - * Required. A {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthority} with initial field values. - * @param {string} [request.requestId] - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1beta1/certificate_authority_service.create_certificate_authority.js - * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_CreateCertificateAuthority_async - */ - createCertificateAuthority( - request?: protos.google.cloud.security.privateca.v1beta1.ICreateCertificateAuthorityRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createCertificateAuthority( - request: protos.google.cloud.security.privateca.v1beta1.ICreateCertificateAuthorityRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createCertificateAuthority( - request: protos.google.cloud.security.privateca.v1beta1.ICreateCertificateAuthorityRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createCertificateAuthority( - request?: protos.google.cloud.security.privateca.v1beta1.ICreateCertificateAuthorityRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createCertificateAuthority(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createCertificateAuthority()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1beta1/certificate_authority_service.create_certificate_authority.js - * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_CreateCertificateAuthority_async - */ - async checkCreateCertificateAuthorityProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createCertificateAuthority, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Disable a {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthority}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name for this {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthority} in the - * format `projects/* /locations/* /certificateAuthorities/*`. - * @param {string} [request.requestId] - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1beta1/certificate_authority_service.disable_certificate_authority.js - * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_DisableCertificateAuthority_async - */ - disableCertificateAuthority( - request?: protos.google.cloud.security.privateca.v1beta1.IDisableCertificateAuthorityRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - disableCertificateAuthority( - request: protos.google.cloud.security.privateca.v1beta1.IDisableCertificateAuthorityRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - disableCertificateAuthority( - request: protos.google.cloud.security.privateca.v1beta1.IDisableCertificateAuthorityRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - disableCertificateAuthority( - request?: protos.google.cloud.security.privateca.v1beta1.IDisableCertificateAuthorityRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.disableCertificateAuthority(request, options, callback); - } -/** - * Check the status of the long running operation returned by `disableCertificateAuthority()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1beta1/certificate_authority_service.disable_certificate_authority.js - * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_DisableCertificateAuthority_async - */ - async checkDisableCertificateAuthorityProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.disableCertificateAuthority, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Enable a {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthority}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name for this {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthority} in the - * format `projects/* /locations/* /certificateAuthorities/*`. - * @param {string} [request.requestId] - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1beta1/certificate_authority_service.enable_certificate_authority.js - * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_EnableCertificateAuthority_async - */ - enableCertificateAuthority( - request?: protos.google.cloud.security.privateca.v1beta1.IEnableCertificateAuthorityRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - enableCertificateAuthority( - request: protos.google.cloud.security.privateca.v1beta1.IEnableCertificateAuthorityRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - enableCertificateAuthority( - request: protos.google.cloud.security.privateca.v1beta1.IEnableCertificateAuthorityRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - enableCertificateAuthority( - request?: protos.google.cloud.security.privateca.v1beta1.IEnableCertificateAuthorityRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.enableCertificateAuthority(request, options, callback); - } -/** - * Check the status of the long running operation returned by `enableCertificateAuthority()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1beta1/certificate_authority_service.enable_certificate_authority.js - * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_EnableCertificateAuthority_async - */ - async checkEnableCertificateAuthorityProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.enableCertificateAuthority, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Restore a {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthority} that is scheduled for deletion. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name for this {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthority} in the - * format `projects/* /locations/* /certificateAuthorities/*`. - * @param {string} [request.requestId] - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1beta1/certificate_authority_service.restore_certificate_authority.js - * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_RestoreCertificateAuthority_async - */ - restoreCertificateAuthority( - request?: protos.google.cloud.security.privateca.v1beta1.IRestoreCertificateAuthorityRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - restoreCertificateAuthority( - request: protos.google.cloud.security.privateca.v1beta1.IRestoreCertificateAuthorityRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - restoreCertificateAuthority( - request: protos.google.cloud.security.privateca.v1beta1.IRestoreCertificateAuthorityRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - restoreCertificateAuthority( - request?: protos.google.cloud.security.privateca.v1beta1.IRestoreCertificateAuthorityRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.restoreCertificateAuthority(request, options, callback); - } -/** - * Check the status of the long running operation returned by `restoreCertificateAuthority()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1beta1/certificate_authority_service.restore_certificate_authority.js - * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_RestoreCertificateAuthority_async - */ - async checkRestoreCertificateAuthorityProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.restoreCertificateAuthority, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Schedule a {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthority} for deletion. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name for this {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthority} in the - * format `projects/* /locations/* /certificateAuthorities/*`. - * @param {string} [request.requestId] - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1beta1/certificate_authority_service.schedule_delete_certificate_authority.js - * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_ScheduleDeleteCertificateAuthority_async - */ - scheduleDeleteCertificateAuthority( - request?: protos.google.cloud.security.privateca.v1beta1.IScheduleDeleteCertificateAuthorityRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - scheduleDeleteCertificateAuthority( - request: protos.google.cloud.security.privateca.v1beta1.IScheduleDeleteCertificateAuthorityRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - scheduleDeleteCertificateAuthority( - request: protos.google.cloud.security.privateca.v1beta1.IScheduleDeleteCertificateAuthorityRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - scheduleDeleteCertificateAuthority( - request?: protos.google.cloud.security.privateca.v1beta1.IScheduleDeleteCertificateAuthorityRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.scheduleDeleteCertificateAuthority(request, options, callback); - } -/** - * Check the status of the long running operation returned by `scheduleDeleteCertificateAuthority()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1beta1/certificate_authority_service.schedule_delete_certificate_authority.js - * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_ScheduleDeleteCertificateAuthority_async - */ - async checkScheduleDeleteCertificateAuthorityProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.scheduleDeleteCertificateAuthority, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Update a {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthority}. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.security.privateca.v1beta1.CertificateAuthority} request.certificateAuthority - * Required. {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthority} with updated values. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. A list of fields to be updated in this request. - * @param {string} [request.requestId] - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1beta1/certificate_authority_service.update_certificate_authority.js - * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificateAuthority_async - */ - updateCertificateAuthority( - request?: protos.google.cloud.security.privateca.v1beta1.IUpdateCertificateAuthorityRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateCertificateAuthority( - request: protos.google.cloud.security.privateca.v1beta1.IUpdateCertificateAuthorityRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateCertificateAuthority( - request: protos.google.cloud.security.privateca.v1beta1.IUpdateCertificateAuthorityRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateCertificateAuthority( - request?: protos.google.cloud.security.privateca.v1beta1.IUpdateCertificateAuthorityRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'certificate_authority.name': request.certificateAuthority!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateCertificateAuthority(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateCertificateAuthority()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1beta1/certificate_authority_service.update_certificate_authority.js - * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificateAuthority_async - */ - async checkUpdateCertificateAuthorityProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.updateCertificateAuthority, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Update a {@link google.cloud.security.privateca.v1beta1.CertificateRevocationList|CertificateRevocationList}. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.security.privateca.v1beta1.CertificateRevocationList} request.certificateRevocationList - * Required. {@link google.cloud.security.privateca.v1beta1.CertificateRevocationList|CertificateRevocationList} with updated values. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. A list of fields to be updated in this request. - * @param {string} [request.requestId] - * Optional. An ID to identify requests. Specify a unique request ID so that if you must - * retry your request, the server will know to ignore the request if it has - * already been completed. The server will guarantee that for at least 60 - * minutes since the first request. - * - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1beta1/certificate_authority_service.update_certificate_revocation_list.js - * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificateRevocationList_async - */ - updateCertificateRevocationList( - request?: protos.google.cloud.security.privateca.v1beta1.IUpdateCertificateRevocationListRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateCertificateRevocationList( - request: protos.google.cloud.security.privateca.v1beta1.IUpdateCertificateRevocationListRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateCertificateRevocationList( - request: protos.google.cloud.security.privateca.v1beta1.IUpdateCertificateRevocationListRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateCertificateRevocationList( - request?: protos.google.cloud.security.privateca.v1beta1.IUpdateCertificateRevocationListRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'certificate_revocation_list.name': request.certificateRevocationList!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateCertificateRevocationList(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateCertificateRevocationList()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1beta1/certificate_authority_service.update_certificate_revocation_list.js - * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificateRevocationList_async - */ - async checkUpdateCertificateRevocationListProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.updateCertificateRevocationList, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists {@link google.cloud.security.privateca.v1beta1.Certificate|Certificates}. - * - * @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.security.privateca.v1beta1.Certificate|Certificates}, in the format - * `projects/* /locations/* /certificateauthorities/*`. - * @param {number} [request.pageSize] - * Optional. Limit on the number of - * {@link google.cloud.security.privateca.v1beta1.Certificate|Certificates} to include in the - * response. Further {@link google.cloud.security.privateca.v1beta1.Certificate|Certificates} can subsequently be obtained - * by including the - * {@link google.cloud.security.privateca.v1beta1.ListCertificatesResponse.next_page_token|ListCertificatesResponse.next_page_token} in a subsequent - * request. If unspecified, the server will pick an appropriate default. - * @param {string} [request.pageToken] - * Optional. Pagination token, returned earlier via - * {@link google.cloud.security.privateca.v1beta1.ListCertificatesResponse.next_page_token|ListCertificatesResponse.next_page_token}. - * @param {string} [request.filter] - * Optional. Only include resources that match the filter in the response. For details - * on supported filters and syntax, see [Certificates Filtering - * documentation](https://cloud.google.com/certificate-authority-service/docs/sorting-filtering-certificates#filtering_support). - * @param {string} [request.orderBy] - * Optional. Specify how the results should be sorted. For details on supported fields - * and syntax, see [Certificates Sorting - * documentation](https://cloud.google.com/certificate-authority-service/docs/sorting-filtering-certificates#sorting_support). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [Certificate]{@link google.cloud.security.privateca.v1beta1.Certificate}. - * 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 `listCertificatesAsync()` - * 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. - */ - listCertificates( - request?: protos.google.cloud.security.privateca.v1beta1.IListCertificatesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.security.privateca.v1beta1.ICertificate[], - protos.google.cloud.security.privateca.v1beta1.IListCertificatesRequest|null, - protos.google.cloud.security.privateca.v1beta1.IListCertificatesResponse - ]>; - listCertificates( - request: protos.google.cloud.security.privateca.v1beta1.IListCertificatesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.security.privateca.v1beta1.IListCertificatesRequest, - protos.google.cloud.security.privateca.v1beta1.IListCertificatesResponse|null|undefined, - protos.google.cloud.security.privateca.v1beta1.ICertificate>): void; - listCertificates( - request: protos.google.cloud.security.privateca.v1beta1.IListCertificatesRequest, - callback: PaginationCallback< - protos.google.cloud.security.privateca.v1beta1.IListCertificatesRequest, - protos.google.cloud.security.privateca.v1beta1.IListCertificatesResponse|null|undefined, - protos.google.cloud.security.privateca.v1beta1.ICertificate>): void; - listCertificates( - request?: protos.google.cloud.security.privateca.v1beta1.IListCertificatesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.security.privateca.v1beta1.IListCertificatesRequest, - protos.google.cloud.security.privateca.v1beta1.IListCertificatesResponse|null|undefined, - protos.google.cloud.security.privateca.v1beta1.ICertificate>, - callback?: PaginationCallback< - protos.google.cloud.security.privateca.v1beta1.IListCertificatesRequest, - protos.google.cloud.security.privateca.v1beta1.IListCertificatesResponse|null|undefined, - protos.google.cloud.security.privateca.v1beta1.ICertificate>): - Promise<[ - protos.google.cloud.security.privateca.v1beta1.ICertificate[], - protos.google.cloud.security.privateca.v1beta1.IListCertificatesRequest|null, - protos.google.cloud.security.privateca.v1beta1.IListCertificatesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listCertificates(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.security.privateca.v1beta1.Certificate|Certificates}, in the format - * `projects/* /locations/* /certificateauthorities/*`. - * @param {number} [request.pageSize] - * Optional. Limit on the number of - * {@link google.cloud.security.privateca.v1beta1.Certificate|Certificates} to include in the - * response. Further {@link google.cloud.security.privateca.v1beta1.Certificate|Certificates} can subsequently be obtained - * by including the - * {@link google.cloud.security.privateca.v1beta1.ListCertificatesResponse.next_page_token|ListCertificatesResponse.next_page_token} in a subsequent - * request. If unspecified, the server will pick an appropriate default. - * @param {string} [request.pageToken] - * Optional. Pagination token, returned earlier via - * {@link google.cloud.security.privateca.v1beta1.ListCertificatesResponse.next_page_token|ListCertificatesResponse.next_page_token}. - * @param {string} [request.filter] - * Optional. Only include resources that match the filter in the response. For details - * on supported filters and syntax, see [Certificates Filtering - * documentation](https://cloud.google.com/certificate-authority-service/docs/sorting-filtering-certificates#filtering_support). - * @param {string} [request.orderBy] - * Optional. Specify how the results should be sorted. For details on supported fields - * and syntax, see [Certificates Sorting - * documentation](https://cloud.google.com/certificate-authority-service/docs/sorting-filtering-certificates#sorting_support). - * @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 [Certificate]{@link google.cloud.security.privateca.v1beta1.Certificate} 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 `listCertificatesAsync()` - * 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. - */ - listCertificatesStream( - request?: protos.google.cloud.security.privateca.v1beta1.IListCertificatesRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listCertificates']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listCertificates.createStream( - this.innerApiCalls.listCertificates as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listCertificates`, 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.security.privateca.v1beta1.Certificate|Certificates}, in the format - * `projects/* /locations/* /certificateauthorities/*`. - * @param {number} [request.pageSize] - * Optional. Limit on the number of - * {@link google.cloud.security.privateca.v1beta1.Certificate|Certificates} to include in the - * response. Further {@link google.cloud.security.privateca.v1beta1.Certificate|Certificates} can subsequently be obtained - * by including the - * {@link google.cloud.security.privateca.v1beta1.ListCertificatesResponse.next_page_token|ListCertificatesResponse.next_page_token} in a subsequent - * request. If unspecified, the server will pick an appropriate default. - * @param {string} [request.pageToken] - * Optional. Pagination token, returned earlier via - * {@link google.cloud.security.privateca.v1beta1.ListCertificatesResponse.next_page_token|ListCertificatesResponse.next_page_token}. - * @param {string} [request.filter] - * Optional. Only include resources that match the filter in the response. For details - * on supported filters and syntax, see [Certificates Filtering - * documentation](https://cloud.google.com/certificate-authority-service/docs/sorting-filtering-certificates#filtering_support). - * @param {string} [request.orderBy] - * Optional. Specify how the results should be sorted. For details on supported fields - * and syntax, see [Certificates Sorting - * documentation](https://cloud.google.com/certificate-authority-service/docs/sorting-filtering-certificates#sorting_support). - * @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 - * [Certificate]{@link google.cloud.security.privateca.v1beta1.Certificate}. 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/v1beta1/certificate_authority_service.list_certificates.js - * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_ListCertificates_async - */ - listCertificatesAsync( - request?: protos.google.cloud.security.privateca.v1beta1.IListCertificatesRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listCertificates']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listCertificates.asyncIterate( - this.innerApiCalls['listCertificates'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - /** - * Lists {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthorities}. - * - * @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.security.privateca.v1beta1.CertificateAuthority|CertificateAuthorities}, in the format - * `projects/* /locations/*`. - * @param {number} [request.pageSize] - * Optional. Limit on the number of {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthorities} to - * include in the response. - * Further {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthorities} can subsequently be - * obtained by including the - * {@link google.cloud.security.privateca.v1beta1.ListCertificateAuthoritiesResponse.next_page_token|ListCertificateAuthoritiesResponse.next_page_token} in a subsequent - * request. If unspecified, the server will pick an appropriate default. - * @param {string} [request.pageToken] - * Optional. Pagination token, returned earlier via - * {@link google.cloud.security.privateca.v1beta1.ListCertificateAuthoritiesResponse.next_page_token|ListCertificateAuthoritiesResponse.next_page_token}. - * @param {string} [request.filter] - * Optional. Only include resources that match the filter in the response. - * @param {string} [request.orderBy] - * Optional. Specify how the results should be sorted. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [CertificateAuthority]{@link google.cloud.security.privateca.v1beta1.CertificateAuthority}. - * 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 `listCertificateAuthoritiesAsync()` - * 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. - */ - listCertificateAuthorities( - request?: protos.google.cloud.security.privateca.v1beta1.IListCertificateAuthoritiesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.security.privateca.v1beta1.ICertificateAuthority[], - protos.google.cloud.security.privateca.v1beta1.IListCertificateAuthoritiesRequest|null, - protos.google.cloud.security.privateca.v1beta1.IListCertificateAuthoritiesResponse - ]>; - listCertificateAuthorities( - request: protos.google.cloud.security.privateca.v1beta1.IListCertificateAuthoritiesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.security.privateca.v1beta1.IListCertificateAuthoritiesRequest, - protos.google.cloud.security.privateca.v1beta1.IListCertificateAuthoritiesResponse|null|undefined, - protos.google.cloud.security.privateca.v1beta1.ICertificateAuthority>): void; - listCertificateAuthorities( - request: protos.google.cloud.security.privateca.v1beta1.IListCertificateAuthoritiesRequest, - callback: PaginationCallback< - protos.google.cloud.security.privateca.v1beta1.IListCertificateAuthoritiesRequest, - protos.google.cloud.security.privateca.v1beta1.IListCertificateAuthoritiesResponse|null|undefined, - protos.google.cloud.security.privateca.v1beta1.ICertificateAuthority>): void; - listCertificateAuthorities( - request?: protos.google.cloud.security.privateca.v1beta1.IListCertificateAuthoritiesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.security.privateca.v1beta1.IListCertificateAuthoritiesRequest, - protos.google.cloud.security.privateca.v1beta1.IListCertificateAuthoritiesResponse|null|undefined, - protos.google.cloud.security.privateca.v1beta1.ICertificateAuthority>, - callback?: PaginationCallback< - protos.google.cloud.security.privateca.v1beta1.IListCertificateAuthoritiesRequest, - protos.google.cloud.security.privateca.v1beta1.IListCertificateAuthoritiesResponse|null|undefined, - protos.google.cloud.security.privateca.v1beta1.ICertificateAuthority>): - Promise<[ - protos.google.cloud.security.privateca.v1beta1.ICertificateAuthority[], - protos.google.cloud.security.privateca.v1beta1.IListCertificateAuthoritiesRequest|null, - protos.google.cloud.security.privateca.v1beta1.IListCertificateAuthoritiesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listCertificateAuthorities(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.security.privateca.v1beta1.CertificateAuthority|CertificateAuthorities}, in the format - * `projects/* /locations/*`. - * @param {number} [request.pageSize] - * Optional. Limit on the number of {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthorities} to - * include in the response. - * Further {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthorities} can subsequently be - * obtained by including the - * {@link google.cloud.security.privateca.v1beta1.ListCertificateAuthoritiesResponse.next_page_token|ListCertificateAuthoritiesResponse.next_page_token} in a subsequent - * request. If unspecified, the server will pick an appropriate default. - * @param {string} [request.pageToken] - * Optional. Pagination token, returned earlier via - * {@link google.cloud.security.privateca.v1beta1.ListCertificateAuthoritiesResponse.next_page_token|ListCertificateAuthoritiesResponse.next_page_token}. - * @param {string} [request.filter] - * Optional. Only include resources that match the filter in the response. - * @param {string} [request.orderBy] - * Optional. Specify how the results should be sorted. - * @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 [CertificateAuthority]{@link google.cloud.security.privateca.v1beta1.CertificateAuthority} 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 `listCertificateAuthoritiesAsync()` - * 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. - */ - listCertificateAuthoritiesStream( - request?: protos.google.cloud.security.privateca.v1beta1.IListCertificateAuthoritiesRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listCertificateAuthorities']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listCertificateAuthorities.createStream( - this.innerApiCalls.listCertificateAuthorities as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listCertificateAuthorities`, 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.security.privateca.v1beta1.CertificateAuthority|CertificateAuthorities}, in the format - * `projects/* /locations/*`. - * @param {number} [request.pageSize] - * Optional. Limit on the number of {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthorities} to - * include in the response. - * Further {@link google.cloud.security.privateca.v1beta1.CertificateAuthority|CertificateAuthorities} can subsequently be - * obtained by including the - * {@link google.cloud.security.privateca.v1beta1.ListCertificateAuthoritiesResponse.next_page_token|ListCertificateAuthoritiesResponse.next_page_token} in a subsequent - * request. If unspecified, the server will pick an appropriate default. - * @param {string} [request.pageToken] - * Optional. Pagination token, returned earlier via - * {@link google.cloud.security.privateca.v1beta1.ListCertificateAuthoritiesResponse.next_page_token|ListCertificateAuthoritiesResponse.next_page_token}. - * @param {string} [request.filter] - * Optional. Only include resources that match the filter in the response. - * @param {string} [request.orderBy] - * Optional. Specify how the results should be sorted. - * @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 - * [CertificateAuthority]{@link google.cloud.security.privateca.v1beta1.CertificateAuthority}. 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/v1beta1/certificate_authority_service.list_certificate_authorities.js - * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_ListCertificateAuthorities_async - */ - listCertificateAuthoritiesAsync( - request?: protos.google.cloud.security.privateca.v1beta1.IListCertificateAuthoritiesRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listCertificateAuthorities']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listCertificateAuthorities.asyncIterate( - this.innerApiCalls['listCertificateAuthorities'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - /** - * Lists {@link google.cloud.security.privateca.v1beta1.CertificateRevocationList|CertificateRevocationLists}. - * - * @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.security.privateca.v1beta1.CertificateRevocationList|CertificateRevocationLists}, in the format - * `projects/* /locations/* /certificateauthorities/*`. - * @param {number} [request.pageSize] - * Optional. Limit on the number of - * {@link google.cloud.security.privateca.v1beta1.CertificateRevocationList|CertificateRevocationLists} to include in the - * response. Further {@link google.cloud.security.privateca.v1beta1.CertificateRevocationList|CertificateRevocationLists} - * can subsequently be obtained by including the - * {@link google.cloud.security.privateca.v1beta1.ListCertificateRevocationListsResponse.next_page_token|ListCertificateRevocationListsResponse.next_page_token} in a subsequent - * request. If unspecified, the server will pick an appropriate default. - * @param {string} [request.pageToken] - * Optional. Pagination token, returned earlier via - * {@link google.cloud.security.privateca.v1beta1.ListCertificateRevocationListsResponse.next_page_token|ListCertificateRevocationListsResponse.next_page_token}. - * @param {string} [request.filter] - * Optional. Only include resources that match the filter in the response. - * @param {string} [request.orderBy] - * Optional. Specify how the results should be sorted. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [CertificateRevocationList]{@link google.cloud.security.privateca.v1beta1.CertificateRevocationList}. - * 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 `listCertificateRevocationListsAsync()` - * 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. - */ - listCertificateRevocationLists( - request?: protos.google.cloud.security.privateca.v1beta1.IListCertificateRevocationListsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.security.privateca.v1beta1.ICertificateRevocationList[], - protos.google.cloud.security.privateca.v1beta1.IListCertificateRevocationListsRequest|null, - protos.google.cloud.security.privateca.v1beta1.IListCertificateRevocationListsResponse - ]>; - listCertificateRevocationLists( - request: protos.google.cloud.security.privateca.v1beta1.IListCertificateRevocationListsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.security.privateca.v1beta1.IListCertificateRevocationListsRequest, - protos.google.cloud.security.privateca.v1beta1.IListCertificateRevocationListsResponse|null|undefined, - protos.google.cloud.security.privateca.v1beta1.ICertificateRevocationList>): void; - listCertificateRevocationLists( - request: protos.google.cloud.security.privateca.v1beta1.IListCertificateRevocationListsRequest, - callback: PaginationCallback< - protos.google.cloud.security.privateca.v1beta1.IListCertificateRevocationListsRequest, - protos.google.cloud.security.privateca.v1beta1.IListCertificateRevocationListsResponse|null|undefined, - protos.google.cloud.security.privateca.v1beta1.ICertificateRevocationList>): void; - listCertificateRevocationLists( - request?: protos.google.cloud.security.privateca.v1beta1.IListCertificateRevocationListsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.security.privateca.v1beta1.IListCertificateRevocationListsRequest, - protos.google.cloud.security.privateca.v1beta1.IListCertificateRevocationListsResponse|null|undefined, - protos.google.cloud.security.privateca.v1beta1.ICertificateRevocationList>, - callback?: PaginationCallback< - protos.google.cloud.security.privateca.v1beta1.IListCertificateRevocationListsRequest, - protos.google.cloud.security.privateca.v1beta1.IListCertificateRevocationListsResponse|null|undefined, - protos.google.cloud.security.privateca.v1beta1.ICertificateRevocationList>): - Promise<[ - protos.google.cloud.security.privateca.v1beta1.ICertificateRevocationList[], - protos.google.cloud.security.privateca.v1beta1.IListCertificateRevocationListsRequest|null, - protos.google.cloud.security.privateca.v1beta1.IListCertificateRevocationListsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listCertificateRevocationLists(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.security.privateca.v1beta1.CertificateRevocationList|CertificateRevocationLists}, in the format - * `projects/* /locations/* /certificateauthorities/*`. - * @param {number} [request.pageSize] - * Optional. Limit on the number of - * {@link google.cloud.security.privateca.v1beta1.CertificateRevocationList|CertificateRevocationLists} to include in the - * response. Further {@link google.cloud.security.privateca.v1beta1.CertificateRevocationList|CertificateRevocationLists} - * can subsequently be obtained by including the - * {@link google.cloud.security.privateca.v1beta1.ListCertificateRevocationListsResponse.next_page_token|ListCertificateRevocationListsResponse.next_page_token} in a subsequent - * request. If unspecified, the server will pick an appropriate default. - * @param {string} [request.pageToken] - * Optional. Pagination token, returned earlier via - * {@link google.cloud.security.privateca.v1beta1.ListCertificateRevocationListsResponse.next_page_token|ListCertificateRevocationListsResponse.next_page_token}. - * @param {string} [request.filter] - * Optional. Only include resources that match the filter in the response. - * @param {string} [request.orderBy] - * Optional. Specify how the results should be sorted. - * @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 [CertificateRevocationList]{@link google.cloud.security.privateca.v1beta1.CertificateRevocationList} 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 `listCertificateRevocationListsAsync()` - * 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. - */ - listCertificateRevocationListsStream( - request?: protos.google.cloud.security.privateca.v1beta1.IListCertificateRevocationListsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listCertificateRevocationLists']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listCertificateRevocationLists.createStream( - this.innerApiCalls.listCertificateRevocationLists as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listCertificateRevocationLists`, 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.security.privateca.v1beta1.CertificateRevocationList|CertificateRevocationLists}, in the format - * `projects/* /locations/* /certificateauthorities/*`. - * @param {number} [request.pageSize] - * Optional. Limit on the number of - * {@link google.cloud.security.privateca.v1beta1.CertificateRevocationList|CertificateRevocationLists} to include in the - * response. Further {@link google.cloud.security.privateca.v1beta1.CertificateRevocationList|CertificateRevocationLists} - * can subsequently be obtained by including the - * {@link google.cloud.security.privateca.v1beta1.ListCertificateRevocationListsResponse.next_page_token|ListCertificateRevocationListsResponse.next_page_token} in a subsequent - * request. If unspecified, the server will pick an appropriate default. - * @param {string} [request.pageToken] - * Optional. Pagination token, returned earlier via - * {@link google.cloud.security.privateca.v1beta1.ListCertificateRevocationListsResponse.next_page_token|ListCertificateRevocationListsResponse.next_page_token}. - * @param {string} [request.filter] - * Optional. Only include resources that match the filter in the response. - * @param {string} [request.orderBy] - * Optional. Specify how the results should be sorted. - * @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 - * [CertificateRevocationList]{@link google.cloud.security.privateca.v1beta1.CertificateRevocationList}. 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/v1beta1/certificate_authority_service.list_certificate_revocation_lists.js - * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_ListCertificateRevocationLists_async - */ - listCertificateRevocationListsAsync( - request?: protos.google.cloud.security.privateca.v1beta1.IListCertificateRevocationListsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listCertificateRevocationLists']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listCertificateRevocationLists.asyncIterate( - this.innerApiCalls['listCertificateRevocationLists'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - /** - * Lists {@link google.cloud.security.privateca.v1beta1.ReusableConfig|ReusableConfigs}. - * - * @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.security.privateca.v1beta1.ReusableConfig|ReusableConfigs}, in the format - * `projects/* /locations/*`. - * @param {number} [request.pageSize] - * Optional. Limit on the number of - * {@link google.cloud.security.privateca.v1beta1.ReusableConfig|ReusableConfigs} to include in the response. - * Further {@link google.cloud.security.privateca.v1beta1.ReusableConfig|ReusableConfigs} can subsequently be - * obtained by including the - * {@link google.cloud.security.privateca.v1beta1.ListReusableConfigsResponse.next_page_token|ListReusableConfigsResponse.next_page_token} in a subsequent request. If - * unspecified, the server will pick an appropriate default. - * @param {string} [request.pageToken] - * Optional. Pagination token, returned earlier via - * {@link google.cloud.security.privateca.v1beta1.ListReusableConfigsResponse.next_page_token|ListReusableConfigsResponse.next_page_token}. - * @param {string} [request.filter] - * Optional. Only include resources that match the filter in the response. - * @param {string} [request.orderBy] - * Optional. Specify how the results should be sorted. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [ReusableConfig]{@link google.cloud.security.privateca.v1beta1.ReusableConfig}. - * 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 `listReusableConfigsAsync()` - * 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. - */ - listReusableConfigs( - request?: protos.google.cloud.security.privateca.v1beta1.IListReusableConfigsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.security.privateca.v1beta1.IReusableConfig[], - protos.google.cloud.security.privateca.v1beta1.IListReusableConfigsRequest|null, - protos.google.cloud.security.privateca.v1beta1.IListReusableConfigsResponse - ]>; - listReusableConfigs( - request: protos.google.cloud.security.privateca.v1beta1.IListReusableConfigsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.security.privateca.v1beta1.IListReusableConfigsRequest, - protos.google.cloud.security.privateca.v1beta1.IListReusableConfigsResponse|null|undefined, - protos.google.cloud.security.privateca.v1beta1.IReusableConfig>): void; - listReusableConfigs( - request: protos.google.cloud.security.privateca.v1beta1.IListReusableConfigsRequest, - callback: PaginationCallback< - protos.google.cloud.security.privateca.v1beta1.IListReusableConfigsRequest, - protos.google.cloud.security.privateca.v1beta1.IListReusableConfigsResponse|null|undefined, - protos.google.cloud.security.privateca.v1beta1.IReusableConfig>): void; - listReusableConfigs( - request?: protos.google.cloud.security.privateca.v1beta1.IListReusableConfigsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.security.privateca.v1beta1.IListReusableConfigsRequest, - protos.google.cloud.security.privateca.v1beta1.IListReusableConfigsResponse|null|undefined, - protos.google.cloud.security.privateca.v1beta1.IReusableConfig>, - callback?: PaginationCallback< - protos.google.cloud.security.privateca.v1beta1.IListReusableConfigsRequest, - protos.google.cloud.security.privateca.v1beta1.IListReusableConfigsResponse|null|undefined, - protos.google.cloud.security.privateca.v1beta1.IReusableConfig>): - Promise<[ - protos.google.cloud.security.privateca.v1beta1.IReusableConfig[], - protos.google.cloud.security.privateca.v1beta1.IListReusableConfigsRequest|null, - protos.google.cloud.security.privateca.v1beta1.IListReusableConfigsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listReusableConfigs(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.security.privateca.v1beta1.ReusableConfig|ReusableConfigs}, in the format - * `projects/* /locations/*`. - * @param {number} [request.pageSize] - * Optional. Limit on the number of - * {@link google.cloud.security.privateca.v1beta1.ReusableConfig|ReusableConfigs} to include in the response. - * Further {@link google.cloud.security.privateca.v1beta1.ReusableConfig|ReusableConfigs} can subsequently be - * obtained by including the - * {@link google.cloud.security.privateca.v1beta1.ListReusableConfigsResponse.next_page_token|ListReusableConfigsResponse.next_page_token} in a subsequent request. If - * unspecified, the server will pick an appropriate default. - * @param {string} [request.pageToken] - * Optional. Pagination token, returned earlier via - * {@link google.cloud.security.privateca.v1beta1.ListReusableConfigsResponse.next_page_token|ListReusableConfigsResponse.next_page_token}. - * @param {string} [request.filter] - * Optional. Only include resources that match the filter in the response. - * @param {string} [request.orderBy] - * Optional. Specify how the results should be sorted. - * @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 [ReusableConfig]{@link google.cloud.security.privateca.v1beta1.ReusableConfig} 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 `listReusableConfigsAsync()` - * 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. - */ - listReusableConfigsStream( - request?: protos.google.cloud.security.privateca.v1beta1.IListReusableConfigsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listReusableConfigs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listReusableConfigs.createStream( - this.innerApiCalls.listReusableConfigs as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listReusableConfigs`, 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.security.privateca.v1beta1.ReusableConfig|ReusableConfigs}, in the format - * `projects/* /locations/*`. - * @param {number} [request.pageSize] - * Optional. Limit on the number of - * {@link google.cloud.security.privateca.v1beta1.ReusableConfig|ReusableConfigs} to include in the response. - * Further {@link google.cloud.security.privateca.v1beta1.ReusableConfig|ReusableConfigs} can subsequently be - * obtained by including the - * {@link google.cloud.security.privateca.v1beta1.ListReusableConfigsResponse.next_page_token|ListReusableConfigsResponse.next_page_token} in a subsequent request. If - * unspecified, the server will pick an appropriate default. - * @param {string} [request.pageToken] - * Optional. Pagination token, returned earlier via - * {@link google.cloud.security.privateca.v1beta1.ListReusableConfigsResponse.next_page_token|ListReusableConfigsResponse.next_page_token}. - * @param {string} [request.filter] - * Optional. Only include resources that match the filter in the response. - * @param {string} [request.orderBy] - * Optional. Specify how the results should be sorted. - * @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 - * [ReusableConfig]{@link google.cloud.security.privateca.v1beta1.ReusableConfig}. 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/v1beta1/certificate_authority_service.list_reusable_configs.js - * region_tag:privateca_v1beta1_generated_CertificateAuthorityService_ListReusableConfigs_async - */ - listReusableConfigsAsync( - request?: protos.google.cloud.security.privateca.v1beta1.IListReusableConfigsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listReusableConfigs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listReusableConfigs.asyncIterate( - this.innerApiCalls['listReusableConfigs'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified certificate resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} certificate_authority - * @param {string} certificate - * @returns {string} Resource name string. - */ - certificatePath(project:string,location:string,certificateAuthority:string,certificate:string) { - return this.pathTemplates.certificatePathTemplate.render({ - project: project, - location: location, - certificate_authority: certificateAuthority, - certificate: certificate, - }); - } - - /** - * Parse the project from Certificate resource. - * - * @param {string} certificateName - * A fully-qualified path representing Certificate resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCertificateName(certificateName: string) { - return this.pathTemplates.certificatePathTemplate.match(certificateName).project; - } - - /** - * Parse the location from Certificate resource. - * - * @param {string} certificateName - * A fully-qualified path representing Certificate resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCertificateName(certificateName: string) { - return this.pathTemplates.certificatePathTemplate.match(certificateName).location; - } - - /** - * Parse the certificate_authority from Certificate resource. - * - * @param {string} certificateName - * A fully-qualified path representing Certificate resource. - * @returns {string} A string representing the certificate_authority. - */ - matchCertificateAuthorityFromCertificateName(certificateName: string) { - return this.pathTemplates.certificatePathTemplate.match(certificateName).certificate_authority; - } - - /** - * Parse the certificate from Certificate resource. - * - * @param {string} certificateName - * A fully-qualified path representing Certificate resource. - * @returns {string} A string representing the certificate. - */ - matchCertificateFromCertificateName(certificateName: string) { - return this.pathTemplates.certificatePathTemplate.match(certificateName).certificate; - } - - /** - * Return a fully-qualified certificateAuthority resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} certificate_authority - * @returns {string} Resource name string. - */ - certificateAuthorityPath(project:string,location:string,certificateAuthority:string) { - return this.pathTemplates.certificateAuthorityPathTemplate.render({ - project: project, - location: location, - certificate_authority: certificateAuthority, - }); - } - - /** - * Parse the project from CertificateAuthority resource. - * - * @param {string} certificateAuthorityName - * A fully-qualified path representing CertificateAuthority resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCertificateAuthorityName(certificateAuthorityName: string) { - return this.pathTemplates.certificateAuthorityPathTemplate.match(certificateAuthorityName).project; - } - - /** - * Parse the location from CertificateAuthority resource. - * - * @param {string} certificateAuthorityName - * A fully-qualified path representing CertificateAuthority resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCertificateAuthorityName(certificateAuthorityName: string) { - return this.pathTemplates.certificateAuthorityPathTemplate.match(certificateAuthorityName).location; - } - - /** - * Parse the certificate_authority from CertificateAuthority resource. - * - * @param {string} certificateAuthorityName - * A fully-qualified path representing CertificateAuthority resource. - * @returns {string} A string representing the certificate_authority. - */ - matchCertificateAuthorityFromCertificateAuthorityName(certificateAuthorityName: string) { - return this.pathTemplates.certificateAuthorityPathTemplate.match(certificateAuthorityName).certificate_authority; - } - - /** - * Return a fully-qualified certificateRevocationList resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} certificate_authority - * @param {string} certificate_revocation_list - * @returns {string} Resource name string. - */ - certificateRevocationListPath(project:string,location:string,certificateAuthority:string,certificateRevocationList:string) { - return this.pathTemplates.certificateRevocationListPathTemplate.render({ - project: project, - location: location, - certificate_authority: certificateAuthority, - certificate_revocation_list: certificateRevocationList, - }); - } - - /** - * Parse the project from CertificateRevocationList resource. - * - * @param {string} certificateRevocationListName - * A fully-qualified path representing CertificateRevocationList resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCertificateRevocationListName(certificateRevocationListName: string) { - return this.pathTemplates.certificateRevocationListPathTemplate.match(certificateRevocationListName).project; - } - - /** - * Parse the location from CertificateRevocationList resource. - * - * @param {string} certificateRevocationListName - * A fully-qualified path representing CertificateRevocationList resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCertificateRevocationListName(certificateRevocationListName: string) { - return this.pathTemplates.certificateRevocationListPathTemplate.match(certificateRevocationListName).location; - } - - /** - * Parse the certificate_authority from CertificateRevocationList resource. - * - * @param {string} certificateRevocationListName - * A fully-qualified path representing CertificateRevocationList resource. - * @returns {string} A string representing the certificate_authority. - */ - matchCertificateAuthorityFromCertificateRevocationListName(certificateRevocationListName: string) { - return this.pathTemplates.certificateRevocationListPathTemplate.match(certificateRevocationListName).certificate_authority; - } - - /** - * Parse the certificate_revocation_list from CertificateRevocationList resource. - * - * @param {string} certificateRevocationListName - * A fully-qualified path representing CertificateRevocationList resource. - * @returns {string} A string representing the certificate_revocation_list. - */ - matchCertificateRevocationListFromCertificateRevocationListName(certificateRevocationListName: string) { - return this.pathTemplates.certificateRevocationListPathTemplate.match(certificateRevocationListName).certificate_revocation_list; - } - - /** - * 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 reusableConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} reusable_config - * @returns {string} Resource name string. - */ - reusableConfigPath(project:string,location:string,reusableConfig:string) { - return this.pathTemplates.reusableConfigPathTemplate.render({ - project: project, - location: location, - reusable_config: reusableConfig, - }); - } - - /** - * Parse the project from ReusableConfig resource. - * - * @param {string} reusableConfigName - * A fully-qualified path representing ReusableConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromReusableConfigName(reusableConfigName: string) { - return this.pathTemplates.reusableConfigPathTemplate.match(reusableConfigName).project; - } - - /** - * Parse the location from ReusableConfig resource. - * - * @param {string} reusableConfigName - * A fully-qualified path representing ReusableConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromReusableConfigName(reusableConfigName: string) { - return this.pathTemplates.reusableConfigPathTemplate.match(reusableConfigName).location; - } - - /** - * Parse the reusable_config from ReusableConfig resource. - * - * @param {string} reusableConfigName - * A fully-qualified path representing ReusableConfig resource. - * @returns {string} A string representing the reusable_config. - */ - matchReusableConfigFromReusableConfigName(reusableConfigName: string) { - return this.pathTemplates.reusableConfigPathTemplate.match(reusableConfigName).reusable_config; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.certificateAuthorityServiceStub && !this._terminated) { - return this.certificateAuthorityServiceStub.then(stub => { - this._terminated = true; - stub.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v1beta1/src/v1beta1/certificate_authority_service_client_config.json b/owl-bot-staging/v1beta1/src/v1beta1/certificate_authority_service_client_config.json deleted file mode 100644 index 76b91dd..0000000 --- a/owl-bot-staging/v1beta1/src/v1beta1/certificate_authority_service_client_config.json +++ /dev/null @@ -1,131 +0,0 @@ -{ - "interfaces": { - "google.cloud.security.privateca.v1beta1.CertificateAuthorityService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unknown_deadline_exceeded_unavailable": [ - "UNKNOWN", - "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": { - "CreateCertificate": { - "timeout_millis": 60000, - "retry_codes_name": "unknown_deadline_exceeded_unavailable", - "retry_params_name": "default" - }, - "GetCertificate": { - "timeout_millis": 60000, - "retry_codes_name": "unknown_deadline_exceeded_unavailable", - "retry_params_name": "default" - }, - "ListCertificates": { - "timeout_millis": 60000, - "retry_codes_name": "unknown_deadline_exceeded_unavailable", - "retry_params_name": "default" - }, - "RevokeCertificate": { - "timeout_millis": 60000, - "retry_codes_name": "unknown_deadline_exceeded_unavailable", - "retry_params_name": "default" - }, - "UpdateCertificate": { - "timeout_millis": 60000, - "retry_codes_name": "unknown_deadline_exceeded_unavailable", - "retry_params_name": "default" - }, - "ActivateCertificateAuthority": { - "timeout_millis": 60000, - "retry_codes_name": "unknown_deadline_exceeded_unavailable", - "retry_params_name": "default" - }, - "CreateCertificateAuthority": { - "timeout_millis": 60000, - "retry_codes_name": "unknown_deadline_exceeded_unavailable", - "retry_params_name": "default" - }, - "DisableCertificateAuthority": { - "timeout_millis": 60000, - "retry_codes_name": "unknown_deadline_exceeded_unavailable", - "retry_params_name": "default" - }, - "EnableCertificateAuthority": { - "timeout_millis": 60000, - "retry_codes_name": "unknown_deadline_exceeded_unavailable", - "retry_params_name": "default" - }, - "FetchCertificateAuthorityCsr": { - "timeout_millis": 60000, - "retry_codes_name": "unknown_deadline_exceeded_unavailable", - "retry_params_name": "default" - }, - "GetCertificateAuthority": { - "timeout_millis": 60000, - "retry_codes_name": "unknown_deadline_exceeded_unavailable", - "retry_params_name": "default" - }, - "ListCertificateAuthorities": { - "timeout_millis": 60000, - "retry_codes_name": "unknown_deadline_exceeded_unavailable", - "retry_params_name": "default" - }, - "RestoreCertificateAuthority": { - "timeout_millis": 60000, - "retry_codes_name": "unknown_deadline_exceeded_unavailable", - "retry_params_name": "default" - }, - "ScheduleDeleteCertificateAuthority": { - "timeout_millis": 60000, - "retry_codes_name": "unknown_deadline_exceeded_unavailable", - "retry_params_name": "default" - }, - "UpdateCertificateAuthority": { - "timeout_millis": 60000, - "retry_codes_name": "unknown_deadline_exceeded_unavailable", - "retry_params_name": "default" - }, - "GetCertificateRevocationList": { - "timeout_millis": 60000, - "retry_codes_name": "unknown_deadline_exceeded_unavailable", - "retry_params_name": "default" - }, - "ListCertificateRevocationLists": { - "timeout_millis": 60000, - "retry_codes_name": "unknown_deadline_exceeded_unavailable", - "retry_params_name": "default" - }, - "UpdateCertificateRevocationList": { - "timeout_millis": 60000, - "retry_codes_name": "unknown_deadline_exceeded_unavailable", - "retry_params_name": "default" - }, - "GetReusableConfig": { - "timeout_millis": 60000, - "retry_codes_name": "unknown_deadline_exceeded_unavailable", - "retry_params_name": "default" - }, - "ListReusableConfigs": { - "timeout_millis": 60000, - "retry_codes_name": "unknown_deadline_exceeded_unavailable", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v1beta1/src/v1beta1/certificate_authority_service_proto_list.json b/owl-bot-staging/v1beta1/src/v1beta1/certificate_authority_service_proto_list.json deleted file mode 100644 index 746af90..0000000 --- a/owl-bot-staging/v1beta1/src/v1beta1/certificate_authority_service_proto_list.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "../../protos/google/cloud/security/privateca/v1beta1/resources.proto", - "../../protos/google/cloud/security/privateca/v1beta1/service.proto" -] diff --git a/owl-bot-staging/v1beta1/src/v1beta1/gapic_metadata.json b/owl-bot-staging/v1beta1/src/v1beta1/gapic_metadata.json deleted file mode 100644 index 79c7f39..0000000 --- a/owl-bot-staging/v1beta1/src/v1beta1/gapic_metadata.json +++ /dev/null @@ -1,239 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.security.privateca.v1beta1", - "libraryPackage": "@google-cloud/security-private-ca", - "services": { - "CertificateAuthorityService": { - "clients": { - "grpc": { - "libraryClient": "CertificateAuthorityServiceClient", - "rpcs": { - "CreateCertificate": { - "methods": [ - "createCertificate" - ] - }, - "GetCertificate": { - "methods": [ - "getCertificate" - ] - }, - "RevokeCertificate": { - "methods": [ - "revokeCertificate" - ] - }, - "UpdateCertificate": { - "methods": [ - "updateCertificate" - ] - }, - "FetchCertificateAuthorityCsr": { - "methods": [ - "fetchCertificateAuthorityCsr" - ] - }, - "GetCertificateAuthority": { - "methods": [ - "getCertificateAuthority" - ] - }, - "GetCertificateRevocationList": { - "methods": [ - "getCertificateRevocationList" - ] - }, - "GetReusableConfig": { - "methods": [ - "getReusableConfig" - ] - }, - "ActivateCertificateAuthority": { - "methods": [ - "activateCertificateAuthority" - ] - }, - "CreateCertificateAuthority": { - "methods": [ - "createCertificateAuthority" - ] - }, - "DisableCertificateAuthority": { - "methods": [ - "disableCertificateAuthority" - ] - }, - "EnableCertificateAuthority": { - "methods": [ - "enableCertificateAuthority" - ] - }, - "RestoreCertificateAuthority": { - "methods": [ - "restoreCertificateAuthority" - ] - }, - "ScheduleDeleteCertificateAuthority": { - "methods": [ - "scheduleDeleteCertificateAuthority" - ] - }, - "UpdateCertificateAuthority": { - "methods": [ - "updateCertificateAuthority" - ] - }, - "UpdateCertificateRevocationList": { - "methods": [ - "updateCertificateRevocationList" - ] - }, - "ListCertificates": { - "methods": [ - "listCertificates", - "listCertificatesStream", - "listCertificatesAsync" - ] - }, - "ListCertificateAuthorities": { - "methods": [ - "listCertificateAuthorities", - "listCertificateAuthoritiesStream", - "listCertificateAuthoritiesAsync" - ] - }, - "ListCertificateRevocationLists": { - "methods": [ - "listCertificateRevocationLists", - "listCertificateRevocationListsStream", - "listCertificateRevocationListsAsync" - ] - }, - "ListReusableConfigs": { - "methods": [ - "listReusableConfigs", - "listReusableConfigsStream", - "listReusableConfigsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "CertificateAuthorityServiceClient", - "rpcs": { - "CreateCertificate": { - "methods": [ - "createCertificate" - ] - }, - "GetCertificate": { - "methods": [ - "getCertificate" - ] - }, - "RevokeCertificate": { - "methods": [ - "revokeCertificate" - ] - }, - "UpdateCertificate": { - "methods": [ - "updateCertificate" - ] - }, - "FetchCertificateAuthorityCsr": { - "methods": [ - "fetchCertificateAuthorityCsr" - ] - }, - "GetCertificateAuthority": { - "methods": [ - "getCertificateAuthority" - ] - }, - "GetCertificateRevocationList": { - "methods": [ - "getCertificateRevocationList" - ] - }, - "GetReusableConfig": { - "methods": [ - "getReusableConfig" - ] - }, - "ActivateCertificateAuthority": { - "methods": [ - "activateCertificateAuthority" - ] - }, - "CreateCertificateAuthority": { - "methods": [ - "createCertificateAuthority" - ] - }, - "DisableCertificateAuthority": { - "methods": [ - "disableCertificateAuthority" - ] - }, - "EnableCertificateAuthority": { - "methods": [ - "enableCertificateAuthority" - ] - }, - "RestoreCertificateAuthority": { - "methods": [ - "restoreCertificateAuthority" - ] - }, - "ScheduleDeleteCertificateAuthority": { - "methods": [ - "scheduleDeleteCertificateAuthority" - ] - }, - "UpdateCertificateAuthority": { - "methods": [ - "updateCertificateAuthority" - ] - }, - "UpdateCertificateRevocationList": { - "methods": [ - "updateCertificateRevocationList" - ] - }, - "ListCertificates": { - "methods": [ - "listCertificates", - "listCertificatesStream", - "listCertificatesAsync" - ] - }, - "ListCertificateAuthorities": { - "methods": [ - "listCertificateAuthorities", - "listCertificateAuthoritiesStream", - "listCertificateAuthoritiesAsync" - ] - }, - "ListCertificateRevocationLists": { - "methods": [ - "listCertificateRevocationLists", - "listCertificateRevocationListsStream", - "listCertificateRevocationListsAsync" - ] - }, - "ListReusableConfigs": { - "methods": [ - "listReusableConfigs", - "listReusableConfigsStream", - "listReusableConfigsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/v1beta1/src/v1beta1/index.ts b/owl-bot-staging/v1beta1/src/v1beta1/index.ts deleted file mode 100644 index 846c95b..0000000 --- a/owl-bot-staging/v1beta1/src/v1beta1/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -// 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 {CertificateAuthorityServiceClient} from './certificate_authority_service_client'; diff --git a/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 8d0d0f8..0000000 --- a/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,27 +0,0 @@ -// 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 privateca = require('@google-cloud/security-private-ca'); - -function main() { - const certificateAuthorityServiceClient = new privateca.CertificateAuthorityServiceClient(); -} - -main(); diff --git a/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 445ab31..0000000 --- a/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -// 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 {CertificateAuthorityServiceClient} from '@google-cloud/security-private-ca'; - -// check that the client class type name can be used -function doStuffWithCertificateAuthorityServiceClient(client: CertificateAuthorityServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const certificateAuthorityServiceClient = new CertificateAuthorityServiceClient(); - doStuffWithCertificateAuthorityServiceClient(certificateAuthorityServiceClient); -} - -main(); diff --git a/owl-bot-staging/v1beta1/system-test/install.ts b/owl-bot-staging/v1beta1/system-test/install.ts deleted file mode 100644 index 8ec4522..0000000 --- a/owl-bot-staging/v1beta1/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// 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/owl-bot-staging/v1beta1/test/gapic_certificate_authority_service_v1beta1.ts b/owl-bot-staging/v1beta1/test/gapic_certificate_authority_service_v1beta1.ts deleted file mode 100644 index df438b7..0000000 --- a/owl-bot-staging/v1beta1/test/gapic_certificate_authority_service_v1beta1.ts +++ /dev/null @@ -1,3271 +0,0 @@ -// 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 certificateauthorityserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1beta1.CertificateAuthorityServiceClient', () => { - it('has servicePath', () => { - const servicePath = certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.certificateAuthorityServiceStub, undefined); - await client.initialize(); - assert(client.certificateAuthorityServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.certificateAuthorityServiceStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.certificateAuthorityServiceStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - 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 certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - 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('createCertificate', () => { - it('invokes createCertificate without error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CreateCertificateRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.Certificate()); - client.innerApiCalls.createCertificate = stubSimpleCall(expectedResponse); - const [response] = await client.createCertificate(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createCertificate as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createCertificate without error using callback', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CreateCertificateRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.Certificate()); - client.innerApiCalls.createCertificate = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createCertificate( - request, - (err?: Error|null, result?: protos.google.cloud.security.privateca.v1beta1.ICertificate|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createCertificate as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createCertificate with error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CreateCertificateRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createCertificate = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createCertificate(request), expectedError); - assert((client.innerApiCalls.createCertificate as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createCertificate with closed client', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CreateCertificateRequest()); - request.parent = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createCertificate(request), expectedError); - }); - }); - - describe('getCertificate', () => { - it('invokes getCertificate without error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.GetCertificateRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.Certificate()); - client.innerApiCalls.getCertificate = stubSimpleCall(expectedResponse); - const [response] = await client.getCertificate(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getCertificate as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getCertificate without error using callback', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.GetCertificateRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.Certificate()); - client.innerApiCalls.getCertificate = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getCertificate( - request, - (err?: Error|null, result?: protos.google.cloud.security.privateca.v1beta1.ICertificate|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getCertificate as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getCertificate with error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.GetCertificateRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getCertificate = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getCertificate(request), expectedError); - assert((client.innerApiCalls.getCertificate as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getCertificate with closed client', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.GetCertificateRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getCertificate(request), expectedError); - }); - }); - - describe('revokeCertificate', () => { - it('invokes revokeCertificate without error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.RevokeCertificateRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.Certificate()); - client.innerApiCalls.revokeCertificate = stubSimpleCall(expectedResponse); - const [response] = await client.revokeCertificate(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.revokeCertificate as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes revokeCertificate without error using callback', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.RevokeCertificateRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.Certificate()); - client.innerApiCalls.revokeCertificate = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.revokeCertificate( - request, - (err?: Error|null, result?: protos.google.cloud.security.privateca.v1beta1.ICertificate|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.revokeCertificate as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes revokeCertificate with error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.RevokeCertificateRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.revokeCertificate = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.revokeCertificate(request), expectedError); - assert((client.innerApiCalls.revokeCertificate as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes revokeCertificate with closed client', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.RevokeCertificateRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.revokeCertificate(request), expectedError); - }); - }); - - describe('updateCertificate', () => { - it('invokes updateCertificate without error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.UpdateCertificateRequest()); - request.certificate = {}; - request.certificate.name = ''; - const expectedHeaderRequestParams = "certificate.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.Certificate()); - client.innerApiCalls.updateCertificate = stubSimpleCall(expectedResponse); - const [response] = await client.updateCertificate(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateCertificate as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateCertificate without error using callback', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.UpdateCertificateRequest()); - request.certificate = {}; - request.certificate.name = ''; - const expectedHeaderRequestParams = "certificate.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.Certificate()); - client.innerApiCalls.updateCertificate = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateCertificate( - request, - (err?: Error|null, result?: protos.google.cloud.security.privateca.v1beta1.ICertificate|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateCertificate as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateCertificate with error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.UpdateCertificateRequest()); - request.certificate = {}; - request.certificate.name = ''; - const expectedHeaderRequestParams = "certificate.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateCertificate = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateCertificate(request), expectedError); - assert((client.innerApiCalls.updateCertificate as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateCertificate with closed client', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.UpdateCertificateRequest()); - request.certificate = {}; - request.certificate.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateCertificate(request), expectedError); - }); - }); - - describe('fetchCertificateAuthorityCsr', () => { - it('invokes fetchCertificateAuthorityCsr without error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.FetchCertificateAuthorityCsrRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.FetchCertificateAuthorityCsrResponse()); - client.innerApiCalls.fetchCertificateAuthorityCsr = stubSimpleCall(expectedResponse); - const [response] = await client.fetchCertificateAuthorityCsr(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.fetchCertificateAuthorityCsr as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes fetchCertificateAuthorityCsr without error using callback', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.FetchCertificateAuthorityCsrRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.FetchCertificateAuthorityCsrResponse()); - client.innerApiCalls.fetchCertificateAuthorityCsr = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.fetchCertificateAuthorityCsr( - request, - (err?: Error|null, result?: protos.google.cloud.security.privateca.v1beta1.IFetchCertificateAuthorityCsrResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.fetchCertificateAuthorityCsr as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes fetchCertificateAuthorityCsr with error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.FetchCertificateAuthorityCsrRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.fetchCertificateAuthorityCsr = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.fetchCertificateAuthorityCsr(request), expectedError); - assert((client.innerApiCalls.fetchCertificateAuthorityCsr as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes fetchCertificateAuthorityCsr with closed client', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.FetchCertificateAuthorityCsrRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.fetchCertificateAuthorityCsr(request), expectedError); - }); - }); - - describe('getCertificateAuthority', () => { - it('invokes getCertificateAuthority without error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.GetCertificateAuthorityRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateAuthority()); - client.innerApiCalls.getCertificateAuthority = stubSimpleCall(expectedResponse); - const [response] = await client.getCertificateAuthority(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getCertificateAuthority without error using callback', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.GetCertificateAuthorityRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateAuthority()); - client.innerApiCalls.getCertificateAuthority = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getCertificateAuthority( - request, - (err?: Error|null, result?: protos.google.cloud.security.privateca.v1beta1.ICertificateAuthority|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getCertificateAuthority with error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.GetCertificateAuthorityRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getCertificateAuthority = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getCertificateAuthority(request), expectedError); - assert((client.innerApiCalls.getCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getCertificateAuthority with closed client', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.GetCertificateAuthorityRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getCertificateAuthority(request), expectedError); - }); - }); - - describe('getCertificateRevocationList', () => { - it('invokes getCertificateRevocationList without error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.GetCertificateRevocationListRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateRevocationList()); - client.innerApiCalls.getCertificateRevocationList = stubSimpleCall(expectedResponse); - const [response] = await client.getCertificateRevocationList(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getCertificateRevocationList as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getCertificateRevocationList without error using callback', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.GetCertificateRevocationListRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateRevocationList()); - client.innerApiCalls.getCertificateRevocationList = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getCertificateRevocationList( - request, - (err?: Error|null, result?: protos.google.cloud.security.privateca.v1beta1.ICertificateRevocationList|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getCertificateRevocationList as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getCertificateRevocationList with error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.GetCertificateRevocationListRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getCertificateRevocationList = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getCertificateRevocationList(request), expectedError); - assert((client.innerApiCalls.getCertificateRevocationList as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getCertificateRevocationList with closed client', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.GetCertificateRevocationListRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getCertificateRevocationList(request), expectedError); - }); - }); - - describe('getReusableConfig', () => { - it('invokes getReusableConfig without error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.GetReusableConfigRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ReusableConfig()); - client.innerApiCalls.getReusableConfig = stubSimpleCall(expectedResponse); - const [response] = await client.getReusableConfig(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getReusableConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getReusableConfig without error using callback', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.GetReusableConfigRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ReusableConfig()); - client.innerApiCalls.getReusableConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getReusableConfig( - request, - (err?: Error|null, result?: protos.google.cloud.security.privateca.v1beta1.IReusableConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getReusableConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getReusableConfig with error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.GetReusableConfigRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getReusableConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getReusableConfig(request), expectedError); - assert((client.innerApiCalls.getReusableConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getReusableConfig with closed client', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.GetReusableConfigRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getReusableConfig(request), expectedError); - }); - }); - - describe('activateCertificateAuthority', () => { - it('invokes activateCertificateAuthority without error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ActivateCertificateAuthorityRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.activateCertificateAuthority = stubLongRunningCall(expectedResponse); - const [operation] = await client.activateCertificateAuthority(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.activateCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes activateCertificateAuthority without error using callback', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ActivateCertificateAuthorityRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.activateCertificateAuthority = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.activateCertificateAuthority( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.activateCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes activateCertificateAuthority with call error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ActivateCertificateAuthorityRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.activateCertificateAuthority = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.activateCertificateAuthority(request), expectedError); - assert((client.innerApiCalls.activateCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes activateCertificateAuthority with LRO error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ActivateCertificateAuthorityRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.activateCertificateAuthority = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.activateCertificateAuthority(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.activateCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkActivateCertificateAuthorityProgress without error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkActivateCertificateAuthorityProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkActivateCertificateAuthorityProgress with error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkActivateCertificateAuthorityProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createCertificateAuthority', () => { - it('invokes createCertificateAuthority without error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CreateCertificateAuthorityRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createCertificateAuthority = stubLongRunningCall(expectedResponse); - const [operation] = await client.createCertificateAuthority(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createCertificateAuthority without error using callback', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CreateCertificateAuthorityRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createCertificateAuthority = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createCertificateAuthority( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createCertificateAuthority with call error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CreateCertificateAuthorityRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createCertificateAuthority = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createCertificateAuthority(request), expectedError); - assert((client.innerApiCalls.createCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createCertificateAuthority with LRO error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CreateCertificateAuthorityRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createCertificateAuthority = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createCertificateAuthority(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.createCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkCreateCertificateAuthorityProgress without error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateCertificateAuthorityProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateCertificateAuthorityProgress with error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateCertificateAuthorityProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('disableCertificateAuthority', () => { - it('invokes disableCertificateAuthority without error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.DisableCertificateAuthorityRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.disableCertificateAuthority = stubLongRunningCall(expectedResponse); - const [operation] = await client.disableCertificateAuthority(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.disableCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes disableCertificateAuthority without error using callback', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.DisableCertificateAuthorityRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.disableCertificateAuthority = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.disableCertificateAuthority( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.disableCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes disableCertificateAuthority with call error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.DisableCertificateAuthorityRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.disableCertificateAuthority = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.disableCertificateAuthority(request), expectedError); - assert((client.innerApiCalls.disableCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes disableCertificateAuthority with LRO error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.DisableCertificateAuthorityRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.disableCertificateAuthority = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.disableCertificateAuthority(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.disableCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkDisableCertificateAuthorityProgress without error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDisableCertificateAuthorityProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDisableCertificateAuthorityProgress with error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDisableCertificateAuthorityProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('enableCertificateAuthority', () => { - it('invokes enableCertificateAuthority without error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.EnableCertificateAuthorityRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.enableCertificateAuthority = stubLongRunningCall(expectedResponse); - const [operation] = await client.enableCertificateAuthority(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.enableCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes enableCertificateAuthority without error using callback', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.EnableCertificateAuthorityRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.enableCertificateAuthority = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.enableCertificateAuthority( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.enableCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes enableCertificateAuthority with call error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.EnableCertificateAuthorityRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.enableCertificateAuthority = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.enableCertificateAuthority(request), expectedError); - assert((client.innerApiCalls.enableCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes enableCertificateAuthority with LRO error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.EnableCertificateAuthorityRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.enableCertificateAuthority = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.enableCertificateAuthority(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.enableCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkEnableCertificateAuthorityProgress without error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkEnableCertificateAuthorityProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkEnableCertificateAuthorityProgress with error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkEnableCertificateAuthorityProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('restoreCertificateAuthority', () => { - it('invokes restoreCertificateAuthority without error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.RestoreCertificateAuthorityRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.restoreCertificateAuthority = stubLongRunningCall(expectedResponse); - const [operation] = await client.restoreCertificateAuthority(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.restoreCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes restoreCertificateAuthority without error using callback', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.RestoreCertificateAuthorityRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.restoreCertificateAuthority = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.restoreCertificateAuthority( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.restoreCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes restoreCertificateAuthority with call error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.RestoreCertificateAuthorityRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.restoreCertificateAuthority = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.restoreCertificateAuthority(request), expectedError); - assert((client.innerApiCalls.restoreCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes restoreCertificateAuthority with LRO error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.RestoreCertificateAuthorityRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.restoreCertificateAuthority = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.restoreCertificateAuthority(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.restoreCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkRestoreCertificateAuthorityProgress without error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkRestoreCertificateAuthorityProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkRestoreCertificateAuthorityProgress with error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkRestoreCertificateAuthorityProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('scheduleDeleteCertificateAuthority', () => { - it('invokes scheduleDeleteCertificateAuthority without error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ScheduleDeleteCertificateAuthorityRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.scheduleDeleteCertificateAuthority = stubLongRunningCall(expectedResponse); - const [operation] = await client.scheduleDeleteCertificateAuthority(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.scheduleDeleteCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes scheduleDeleteCertificateAuthority without error using callback', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ScheduleDeleteCertificateAuthorityRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.scheduleDeleteCertificateAuthority = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.scheduleDeleteCertificateAuthority( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.scheduleDeleteCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes scheduleDeleteCertificateAuthority with call error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ScheduleDeleteCertificateAuthorityRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.scheduleDeleteCertificateAuthority = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.scheduleDeleteCertificateAuthority(request), expectedError); - assert((client.innerApiCalls.scheduleDeleteCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes scheduleDeleteCertificateAuthority with LRO error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ScheduleDeleteCertificateAuthorityRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.scheduleDeleteCertificateAuthority = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.scheduleDeleteCertificateAuthority(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.scheduleDeleteCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkScheduleDeleteCertificateAuthorityProgress without error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkScheduleDeleteCertificateAuthorityProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkScheduleDeleteCertificateAuthorityProgress with error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkScheduleDeleteCertificateAuthorityProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateCertificateAuthority', () => { - it('invokes updateCertificateAuthority without error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.UpdateCertificateAuthorityRequest()); - request.certificateAuthority = {}; - request.certificateAuthority.name = ''; - const expectedHeaderRequestParams = "certificate_authority.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.updateCertificateAuthority = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateCertificateAuthority(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateCertificateAuthority without error using callback', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.UpdateCertificateAuthorityRequest()); - request.certificateAuthority = {}; - request.certificateAuthority.name = ''; - const expectedHeaderRequestParams = "certificate_authority.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.updateCertificateAuthority = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateCertificateAuthority( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateCertificateAuthority with call error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.UpdateCertificateAuthorityRequest()); - request.certificateAuthority = {}; - request.certificateAuthority.name = ''; - const expectedHeaderRequestParams = "certificate_authority.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateCertificateAuthority = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateCertificateAuthority(request), expectedError); - assert((client.innerApiCalls.updateCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateCertificateAuthority with LRO error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.UpdateCertificateAuthorityRequest()); - request.certificateAuthority = {}; - request.certificateAuthority.name = ''; - const expectedHeaderRequestParams = "certificate_authority.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateCertificateAuthority = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateCertificateAuthority(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.updateCertificateAuthority as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkUpdateCertificateAuthorityProgress without error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateCertificateAuthorityProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateCertificateAuthorityProgress with error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateCertificateAuthorityProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateCertificateRevocationList', () => { - it('invokes updateCertificateRevocationList without error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.UpdateCertificateRevocationListRequest()); - request.certificateRevocationList = {}; - request.certificateRevocationList.name = ''; - const expectedHeaderRequestParams = "certificate_revocation_list.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.updateCertificateRevocationList = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateCertificateRevocationList(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateCertificateRevocationList as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateCertificateRevocationList without error using callback', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.UpdateCertificateRevocationListRequest()); - request.certificateRevocationList = {}; - request.certificateRevocationList.name = ''; - const expectedHeaderRequestParams = "certificate_revocation_list.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.updateCertificateRevocationList = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateCertificateRevocationList( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateCertificateRevocationList as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateCertificateRevocationList with call error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.UpdateCertificateRevocationListRequest()); - request.certificateRevocationList = {}; - request.certificateRevocationList.name = ''; - const expectedHeaderRequestParams = "certificate_revocation_list.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateCertificateRevocationList = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateCertificateRevocationList(request), expectedError); - assert((client.innerApiCalls.updateCertificateRevocationList as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateCertificateRevocationList with LRO error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.UpdateCertificateRevocationListRequest()); - request.certificateRevocationList = {}; - request.certificateRevocationList.name = ''; - const expectedHeaderRequestParams = "certificate_revocation_list.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateCertificateRevocationList = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateCertificateRevocationList(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.updateCertificateRevocationList as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkUpdateCertificateRevocationListProgress without error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateCertificateRevocationListProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateCertificateRevocationListProgress with error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateCertificateRevocationListProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listCertificates', () => { - it('invokes listCertificates without error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListCertificatesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.Certificate()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.Certificate()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.Certificate()), - ]; - client.innerApiCalls.listCertificates = stubSimpleCall(expectedResponse); - const [response] = await client.listCertificates(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listCertificates as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listCertificates without error using callback', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListCertificatesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.Certificate()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.Certificate()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.Certificate()), - ]; - client.innerApiCalls.listCertificates = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listCertificates( - request, - (err?: Error|null, result?: protos.google.cloud.security.privateca.v1beta1.ICertificate[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listCertificates as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listCertificates with error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListCertificatesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listCertificates = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listCertificates(request), expectedError); - assert((client.innerApiCalls.listCertificates as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listCertificatesStream without error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListCertificatesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.Certificate()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.Certificate()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.Certificate()), - ]; - client.descriptors.page.listCertificates.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listCertificatesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.security.privateca.v1beta1.Certificate[] = []; - stream.on('data', (response: protos.google.cloud.security.privateca.v1beta1.Certificate) => { - 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.listCertificates.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCertificates, request)); - assert.strictEqual( - (client.descriptors.page.listCertificates.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listCertificatesStream with error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListCertificatesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listCertificates.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listCertificatesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.security.privateca.v1beta1.Certificate[] = []; - stream.on('data', (response: protos.google.cloud.security.privateca.v1beta1.Certificate) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listCertificates.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCertificates, request)); - assert.strictEqual( - (client.descriptors.page.listCertificates.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listCertificates without error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListCertificatesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.Certificate()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.Certificate()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.Certificate()), - ]; - client.descriptors.page.listCertificates.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.security.privateca.v1beta1.ICertificate[] = []; - const iterable = client.listCertificatesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listCertificates.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listCertificates.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listCertificates with error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListCertificatesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listCertificates.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listCertificatesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.security.privateca.v1beta1.ICertificate[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listCertificates.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listCertificates.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('listCertificateAuthorities', () => { - it('invokes listCertificateAuthorities without error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListCertificateAuthoritiesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateAuthority()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateAuthority()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateAuthority()), - ]; - client.innerApiCalls.listCertificateAuthorities = stubSimpleCall(expectedResponse); - const [response] = await client.listCertificateAuthorities(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listCertificateAuthorities as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listCertificateAuthorities without error using callback', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListCertificateAuthoritiesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateAuthority()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateAuthority()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateAuthority()), - ]; - client.innerApiCalls.listCertificateAuthorities = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listCertificateAuthorities( - request, - (err?: Error|null, result?: protos.google.cloud.security.privateca.v1beta1.ICertificateAuthority[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listCertificateAuthorities as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listCertificateAuthorities with error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListCertificateAuthoritiesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listCertificateAuthorities = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listCertificateAuthorities(request), expectedError); - assert((client.innerApiCalls.listCertificateAuthorities as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listCertificateAuthoritiesStream without error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListCertificateAuthoritiesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateAuthority()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateAuthority()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateAuthority()), - ]; - client.descriptors.page.listCertificateAuthorities.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listCertificateAuthoritiesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.security.privateca.v1beta1.CertificateAuthority[] = []; - stream.on('data', (response: protos.google.cloud.security.privateca.v1beta1.CertificateAuthority) => { - 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.listCertificateAuthorities.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCertificateAuthorities, request)); - assert.strictEqual( - (client.descriptors.page.listCertificateAuthorities.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listCertificateAuthoritiesStream with error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListCertificateAuthoritiesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listCertificateAuthorities.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listCertificateAuthoritiesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.security.privateca.v1beta1.CertificateAuthority[] = []; - stream.on('data', (response: protos.google.cloud.security.privateca.v1beta1.CertificateAuthority) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listCertificateAuthorities.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCertificateAuthorities, request)); - assert.strictEqual( - (client.descriptors.page.listCertificateAuthorities.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listCertificateAuthorities without error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListCertificateAuthoritiesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateAuthority()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateAuthority()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateAuthority()), - ]; - client.descriptors.page.listCertificateAuthorities.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.security.privateca.v1beta1.ICertificateAuthority[] = []; - const iterable = client.listCertificateAuthoritiesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listCertificateAuthorities.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listCertificateAuthorities.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listCertificateAuthorities with error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListCertificateAuthoritiesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listCertificateAuthorities.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listCertificateAuthoritiesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.security.privateca.v1beta1.ICertificateAuthority[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listCertificateAuthorities.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listCertificateAuthorities.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('listCertificateRevocationLists', () => { - it('invokes listCertificateRevocationLists without error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListCertificateRevocationListsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateRevocationList()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateRevocationList()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateRevocationList()), - ]; - client.innerApiCalls.listCertificateRevocationLists = stubSimpleCall(expectedResponse); - const [response] = await client.listCertificateRevocationLists(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listCertificateRevocationLists as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listCertificateRevocationLists without error using callback', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListCertificateRevocationListsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateRevocationList()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateRevocationList()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateRevocationList()), - ]; - client.innerApiCalls.listCertificateRevocationLists = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listCertificateRevocationLists( - request, - (err?: Error|null, result?: protos.google.cloud.security.privateca.v1beta1.ICertificateRevocationList[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listCertificateRevocationLists as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listCertificateRevocationLists with error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListCertificateRevocationListsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listCertificateRevocationLists = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listCertificateRevocationLists(request), expectedError); - assert((client.innerApiCalls.listCertificateRevocationLists as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listCertificateRevocationListsStream without error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListCertificateRevocationListsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateRevocationList()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateRevocationList()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateRevocationList()), - ]; - client.descriptors.page.listCertificateRevocationLists.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listCertificateRevocationListsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.security.privateca.v1beta1.CertificateRevocationList[] = []; - stream.on('data', (response: protos.google.cloud.security.privateca.v1beta1.CertificateRevocationList) => { - 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.listCertificateRevocationLists.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCertificateRevocationLists, request)); - assert.strictEqual( - (client.descriptors.page.listCertificateRevocationLists.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listCertificateRevocationListsStream with error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListCertificateRevocationListsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listCertificateRevocationLists.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listCertificateRevocationListsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.security.privateca.v1beta1.CertificateRevocationList[] = []; - stream.on('data', (response: protos.google.cloud.security.privateca.v1beta1.CertificateRevocationList) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listCertificateRevocationLists.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCertificateRevocationLists, request)); - assert.strictEqual( - (client.descriptors.page.listCertificateRevocationLists.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listCertificateRevocationLists without error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListCertificateRevocationListsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateRevocationList()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateRevocationList()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.CertificateRevocationList()), - ]; - client.descriptors.page.listCertificateRevocationLists.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.security.privateca.v1beta1.ICertificateRevocationList[] = []; - const iterable = client.listCertificateRevocationListsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listCertificateRevocationLists.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listCertificateRevocationLists.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listCertificateRevocationLists with error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListCertificateRevocationListsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listCertificateRevocationLists.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listCertificateRevocationListsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.security.privateca.v1beta1.ICertificateRevocationList[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listCertificateRevocationLists.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listCertificateRevocationLists.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('listReusableConfigs', () => { - it('invokes listReusableConfigs without error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListReusableConfigsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ReusableConfig()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ReusableConfig()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ReusableConfig()), - ]; - client.innerApiCalls.listReusableConfigs = stubSimpleCall(expectedResponse); - const [response] = await client.listReusableConfigs(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listReusableConfigs as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listReusableConfigs without error using callback', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListReusableConfigsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ReusableConfig()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ReusableConfig()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ReusableConfig()), - ]; - client.innerApiCalls.listReusableConfigs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listReusableConfigs( - request, - (err?: Error|null, result?: protos.google.cloud.security.privateca.v1beta1.IReusableConfig[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listReusableConfigs as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listReusableConfigs with error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListReusableConfigsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listReusableConfigs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listReusableConfigs(request), expectedError); - assert((client.innerApiCalls.listReusableConfigs as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listReusableConfigsStream without error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListReusableConfigsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ReusableConfig()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ReusableConfig()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ReusableConfig()), - ]; - client.descriptors.page.listReusableConfigs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listReusableConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.security.privateca.v1beta1.ReusableConfig[] = []; - stream.on('data', (response: protos.google.cloud.security.privateca.v1beta1.ReusableConfig) => { - 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.listReusableConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listReusableConfigs, request)); - assert.strictEqual( - (client.descriptors.page.listReusableConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listReusableConfigsStream with error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListReusableConfigsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listReusableConfigs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listReusableConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.security.privateca.v1beta1.ReusableConfig[] = []; - stream.on('data', (response: protos.google.cloud.security.privateca.v1beta1.ReusableConfig) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listReusableConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listReusableConfigs, request)); - assert.strictEqual( - (client.descriptors.page.listReusableConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listReusableConfigs without error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListReusableConfigsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ReusableConfig()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ReusableConfig()), - generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ReusableConfig()), - ]; - client.descriptors.page.listReusableConfigs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.security.privateca.v1beta1.IReusableConfig[] = []; - const iterable = client.listReusableConfigsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listReusableConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listReusableConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listReusableConfigs with error', async () => { - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.security.privateca.v1beta1.ListReusableConfigsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listReusableConfigs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listReusableConfigsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.security.privateca.v1beta1.IReusableConfig[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listReusableConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listReusableConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - - describe('certificate', () => { - const fakePath = "/rendered/path/certificate"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - certificate_authority: "certificateAuthorityValue", - certificate: "certificateValue", - }; - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.certificatePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.certificatePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('certificatePath', () => { - const result = client.certificatePath("projectValue", "locationValue", "certificateAuthorityValue", "certificateValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.certificatePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCertificateName', () => { - const result = client.matchProjectFromCertificateName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.certificatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCertificateName', () => { - const result = client.matchLocationFromCertificateName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.certificatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCertificateAuthorityFromCertificateName', () => { - const result = client.matchCertificateAuthorityFromCertificateName(fakePath); - assert.strictEqual(result, "certificateAuthorityValue"); - assert((client.pathTemplates.certificatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCertificateFromCertificateName', () => { - const result = client.matchCertificateFromCertificateName(fakePath); - assert.strictEqual(result, "certificateValue"); - assert((client.pathTemplates.certificatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('certificateAuthority', () => { - const fakePath = "/rendered/path/certificateAuthority"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - certificate_authority: "certificateAuthorityValue", - }; - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.certificateAuthorityPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.certificateAuthorityPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('certificateAuthorityPath', () => { - const result = client.certificateAuthorityPath("projectValue", "locationValue", "certificateAuthorityValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.certificateAuthorityPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCertificateAuthorityName', () => { - const result = client.matchProjectFromCertificateAuthorityName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.certificateAuthorityPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCertificateAuthorityName', () => { - const result = client.matchLocationFromCertificateAuthorityName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.certificateAuthorityPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCertificateAuthorityFromCertificateAuthorityName', () => { - const result = client.matchCertificateAuthorityFromCertificateAuthorityName(fakePath); - assert.strictEqual(result, "certificateAuthorityValue"); - assert((client.pathTemplates.certificateAuthorityPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('certificateRevocationList', () => { - const fakePath = "/rendered/path/certificateRevocationList"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - certificate_authority: "certificateAuthorityValue", - certificate_revocation_list: "certificateRevocationListValue", - }; - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.certificateRevocationListPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.certificateRevocationListPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('certificateRevocationListPath', () => { - const result = client.certificateRevocationListPath("projectValue", "locationValue", "certificateAuthorityValue", "certificateRevocationListValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.certificateRevocationListPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCertificateRevocationListName', () => { - const result = client.matchProjectFromCertificateRevocationListName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.certificateRevocationListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCertificateRevocationListName', () => { - const result = client.matchLocationFromCertificateRevocationListName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.certificateRevocationListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCertificateAuthorityFromCertificateRevocationListName', () => { - const result = client.matchCertificateAuthorityFromCertificateRevocationListName(fakePath); - assert.strictEqual(result, "certificateAuthorityValue"); - assert((client.pathTemplates.certificateRevocationListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCertificateRevocationListFromCertificateRevocationListName', () => { - const result = client.matchCertificateRevocationListFromCertificateRevocationListName(fakePath); - assert.strictEqual(result, "certificateRevocationListValue"); - assert((client.pathTemplates.certificateRevocationListPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - 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('reusableConfig', () => { - const fakePath = "/rendered/path/reusableConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - reusable_config: "reusableConfigValue", - }; - const client = new certificateauthorityserviceModule.v1beta1.CertificateAuthorityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.reusableConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.reusableConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('reusableConfigPath', () => { - const result = client.reusableConfigPath("projectValue", "locationValue", "reusableConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.reusableConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromReusableConfigName', () => { - const result = client.matchProjectFromReusableConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.reusableConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromReusableConfigName', () => { - const result = client.matchLocationFromReusableConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.reusableConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchReusableConfigFromReusableConfigName', () => { - const result = client.matchReusableConfigFromReusableConfigName(fakePath); - assert.strictEqual(result, "reusableConfigValue"); - assert((client.pathTemplates.reusableConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/v1beta1/tsconfig.json b/owl-bot-staging/v1beta1/tsconfig.json deleted file mode 100644 index c78f1c8..0000000 --- a/owl-bot-staging/v1beta1/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "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/owl-bot-staging/v1beta1/webpack.config.js b/owl-bot-staging/v1beta1/webpack.config.js deleted file mode 100644 index a187538..0000000 --- a/owl-bot-staging/v1beta1/webpack.config.js +++ /dev/null @@ -1,64 +0,0 @@ -// 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: 'CertificateAuthorityService', - filename: './certificate-authority-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/src/v1/certificate_authority_service_client.ts b/src/v1/certificate_authority_service_client.ts index 16ecd81..4c2d4e9 100644 --- a/src/v1/certificate_authority_service_client.ts +++ b/src/v1/certificate_authority_service_client.ts @@ -23,6 +23,7 @@ import { CallOptions, Descriptors, ClientOptions, + GrpcClientOptions, LROperation, PaginationCallback, GaxCall, @@ -79,7 +80,7 @@ export class CertificateAuthorityServiceClient { * * @param {object} [options] - The configuration object. * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). * The common options are: * @param {object} [options.credentials] - Credentials object. * @param {string} [options.credentials.client_email] @@ -102,11 +103,10 @@ export class CertificateAuthorityServiceClient { * API remote host. * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. */ constructor(opts?: ClientOptions) { // Ensure that options include all the required fields. @@ -229,16 +229,87 @@ export class CertificateAuthorityServiceClient { }; const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a // an Operation object that allows for tracking of the operation, // rather than holding a request open. - + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [ + { + selector: 'google.cloud.location.Locations.GetLocation', + get: '/v1/{name=projects/*/locations/*}', + }, + { + selector: 'google.cloud.location.Locations.ListLocations', + get: '/v1/{name=projects/*}/locations', + }, + { + selector: 'google.iam.v1.IAMPolicy.GetIamPolicy', + get: '/v1/{resource=projects/*/locations/*/caPools/*}:getIamPolicy', + additional_bindings: [ + { + get: '/v1/{resource=projects/*/locations/*/certificateTemplates/*}:getIamPolicy', + }, + { + get: '/v1/{resource=projects/*/locations/*/caPools/*/certificateAuthorities/*/certificateRevocationLists/*}:getIamPolicy', + }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.SetIamPolicy', + post: '/v1/{resource=projects/*/locations/*/caPools/*}:setIamPolicy', + body: '*', + additional_bindings: [ + { + post: '/v1/{resource=projects/*/locations/*/certificateTemplates/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/caPools/*/certificateAuthorities/*/certificateRevocationLists/*}:setIamPolicy', + body: '*', + }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.TestIamPermissions', + post: '/v1/{resource=projects/*/locations/*/caPools/*}:testIamPermissions', + body: '*', + additional_bindings: [ + { + post: '/v1/{resource=projects/*/locations/*/certificateTemplates/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/caPools/*/certificateAuthorities/*/certificateRevocationLists/*}:testIamPermissions', + body: '*', + }, + ], + }, + { + selector: 'google.longrunning.Operations.CancelOperation', + post: '/v1/{name=projects/*/locations/*/operations/*}:cancel', + body: '*', + }, + { + selector: 'google.longrunning.Operations.DeleteOperation', + delete: '/v1/{name=projects/*/locations/*/operations/*}', + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v1/{name=projects/*/locations/*/operations/*}', + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v1/{name=projects/*/locations/*}/operations', + }, + ]; + } this.operationsClient = this._gaxModule - .lro({ - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, - }) + .lro(lroOptions) .operationsClient(opts); const activateCertificateAuthorityResponse = protoFilesRoot.lookup( '.google.cloud.security.privateca.v1.CertificateAuthority' diff --git a/src/v1beta1/certificate_authority_service_client.ts b/src/v1beta1/certificate_authority_service_client.ts index 97fb5c3..a03a007 100644 --- a/src/v1beta1/certificate_authority_service_client.ts +++ b/src/v1beta1/certificate_authority_service_client.ts @@ -23,6 +23,7 @@ import { CallOptions, Descriptors, ClientOptions, + GrpcClientOptions, LROperation, PaginationCallback, GaxCall, @@ -73,7 +74,7 @@ export class CertificateAuthorityServiceClient { * * @param {object} [options] - The configuration object. * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). * The common options are: * @param {object} [options.credentials] - Credentials object. * @param {string} [options.credentials.client_email] @@ -96,11 +97,10 @@ export class CertificateAuthorityServiceClient { * API remote host. * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. */ constructor(opts?: ClientOptions) { // Ensure that options include all the required fields. @@ -212,16 +212,19 @@ export class CertificateAuthorityServiceClient { }; const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a // an Operation object that allows for tracking of the operation, // rather than holding a request open. - + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = []; + } this.operationsClient = this._gaxModule - .lro({ - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, - }) + .lro(lroOptions) .operationsClient(opts); const activateCertificateAuthorityResponse = protoFilesRoot.lookup( '.google.cloud.security.privateca.v1beta1.CertificateAuthority'