From 4ad11a4996e82b9c03482fda544126ffdc51fbee Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Tue, 20 Dec 2022 20:01:07 +0000 Subject: [PATCH 1/2] feat: add AllowedDomainSettings to the UpdateIapSettingsRequest feat: add AttributePropagationSettings to the UpdateIapSettingsRequest feat: add remediation_token_generation_enabled to the CsmSettings chore: deprecate password reauth method which will no longer be accepted by IAP APIs. PiperOrigin-RevId: 496681848 Source-Link: https://github.com/googleapis/googleapis/commit/be2d54edde28d76a0e16062dfcb10bc560084cb0 Source-Link: https://github.com/googleapis/googleapis-gen/commit/dae449b4d3a49406eb49b410055bdf430c51a883 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWlhcC8uT3dsQm90LnlhbWwiLCJoIjoiZGFlNDQ5YjRkM2E0OTQwNmViNDliNDEwMDU1YmRmNDMwYzUxYTg4MyJ9 --- .../google-cloud-iap/v1/.eslintignore | 7 + .../google-cloud-iap/v1/.eslintrc.json | 3 + .../google-cloud-iap/v1/.gitignore | 14 + owl-bot-staging/google-cloud-iap/v1/.jsdoc.js | 55 + .../google-cloud-iap/v1/.mocharc.js | 33 + .../google-cloud-iap/v1/.prettierrc.js | 22 + owl-bot-staging/google-cloud-iap/v1/README.md | 1 + .../v1/linkinator.config.json | 16 + .../google-cloud-iap/v1/package.json | 65 + .../protos/google/cloud/iap/v1/service.proto | 725 ++++++++ ..._admin_service.create_tunnel_dest_group.js | 76 + ..._admin_service.delete_tunnel_dest_group.js | 63 + ...ware_proxy_admin_service.get_iam_policy.js | 67 + ...re_proxy_admin_service.get_iap_settings.js | 63 + ...oxy_admin_service.get_tunnel_dest_group.js | 63 + ...y_admin_service.list_tunnel_dest_groups.js | 81 + ...ware_proxy_admin_service.set_iam_policy.js | 77 + ...roxy_admin_service.test_iam_permissions.js | 70 + ...proxy_admin_service.update_iap_settings.js | 69 + ..._admin_service.update_tunnel_dest_group.js | 67 + ...aware_proxy_o_auth_service.create_brand.js | 67 + ...vice.create_identity_aware_proxy_client.js | 69 + ...vice.delete_identity_aware_proxy_client.js | 63 + ...ty_aware_proxy_o_auth_service.get_brand.js | 62 + ...service.get_identity_aware_proxy_client.js | 63 + ..._aware_proxy_o_auth_service.list_brands.js | 62 + ...rvice.list_identity_aware_proxy_clients.js | 79 + ...eset_identity_aware_proxy_client_secret.js | 63 + .../snippet_metadata.google.cloud.iap.v1.json | 791 +++++++++ .../google-cloud-iap/v1/src/index.ts | 27 + .../v1/src/v1/gapic_metadata.json | 225 +++ ...entity_aware_proxy_admin_service_client.ts | 1348 +++++++++++++++ ...are_proxy_admin_service_client_config.json | 76 + ..._aware_proxy_admin_service_proto_list.json | 3 + ...ntity_aware_proxy_o_auth_service_client.ts | 1171 +++++++++++++ ...re_proxy_o_auth_service_client_config.json | 66 + ...aware_proxy_o_auth_service_proto_list.json | 3 + .../google-cloud-iap/v1/src/v1/index.ts | 20 + .../system-test/fixtures/sample/src/index.js | 28 + .../system-test/fixtures/sample/src/index.ts | 38 + .../v1/system-test/install.ts | 49 + ...c_identity_aware_proxy_admin_service_v1.ts | 1539 +++++++++++++++++ ..._identity_aware_proxy_o_auth_service_v1.ts | 1315 ++++++++++++++ .../google-cloud-iap/v1/tsconfig.json | 19 + .../google-cloud-iap/v1/webpack.config.js | 64 + .../google-cloud-iap/v1beta1/.eslintignore | 7 + .../google-cloud-iap/v1beta1/.eslintrc.json | 3 + .../google-cloud-iap/v1beta1/.gitignore | 14 + .../google-cloud-iap/v1beta1/.jsdoc.js | 55 + .../google-cloud-iap/v1beta1/.mocharc.js | 33 + .../google-cloud-iap/v1beta1/.prettierrc.js | 22 + .../google-cloud-iap/v1beta1/README.md | 1 + .../v1beta1/linkinator.config.json | 16 + .../google-cloud-iap/v1beta1/package.json | 64 + .../google/cloud/iap/v1beta1/service.proto | 71 + ...are_proxy_admin_v1_beta1.get_iam_policy.js | 67 + ...are_proxy_admin_v1_beta1.set_iam_policy.js | 77 + ...oxy_admin_v1_beta1.test_iam_permissions.js | 70 + ...pet_metadata.google.cloud.iap.v1beta1.json | 151 ++ .../google-cloud-iap/v1beta1/src/index.ts | 25 + .../v1beta1/src/v1beta1/gapic_metadata.json | 53 + ...ntity_aware_proxy_admin_v1_beta1_client.ts | 553 ++++++ ...re_proxy_admin_v1_beta1_client_config.json | 41 + ...aware_proxy_admin_v1_beta1_proto_list.json | 3 + .../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 + ...tity_aware_proxy_admin_v1_beta1_v1beta1.ts | 474 +++++ .../google-cloud-iap/v1beta1/tsconfig.json | 19 + .../v1beta1/webpack.config.js | 64 + 71 files changed, 10957 insertions(+) create mode 100644 owl-bot-staging/google-cloud-iap/v1/.eslintignore create mode 100644 owl-bot-staging/google-cloud-iap/v1/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-iap/v1/.gitignore create mode 100644 owl-bot-staging/google-cloud-iap/v1/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-iap/v1/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-iap/v1/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-iap/v1/README.md create mode 100644 owl-bot-staging/google-cloud-iap/v1/linkinator.config.json create mode 100644 owl-bot-staging/google-cloud-iap/v1/package.json create mode 100644 owl-bot-staging/google-cloud-iap/v1/protos/google/cloud/iap/v1/service.proto create mode 100644 owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.create_tunnel_dest_group.js create mode 100644 owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.delete_tunnel_dest_group.js create mode 100644 owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.get_iam_policy.js create mode 100644 owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.get_iap_settings.js create mode 100644 owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.get_tunnel_dest_group.js create mode 100644 owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.list_tunnel_dest_groups.js create mode 100644 owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.set_iam_policy.js create mode 100644 owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.test_iam_permissions.js create mode 100644 owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.update_iap_settings.js create mode 100644 owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.update_tunnel_dest_group.js create mode 100644 owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.create_brand.js create mode 100644 owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.create_identity_aware_proxy_client.js create mode 100644 owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.delete_identity_aware_proxy_client.js create mode 100644 owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.get_brand.js create mode 100644 owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.get_identity_aware_proxy_client.js create mode 100644 owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.list_brands.js create mode 100644 owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.list_identity_aware_proxy_clients.js create mode 100644 owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.reset_identity_aware_proxy_client_secret.js create mode 100644 owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/snippet_metadata.google.cloud.iap.v1.json create mode 100644 owl-bot-staging/google-cloud-iap/v1/src/index.ts create mode 100644 owl-bot-staging/google-cloud-iap/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_admin_service_client.ts create mode 100644 owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_admin_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_admin_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_o_auth_service_client.ts create mode 100644 owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_o_auth_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_o_auth_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-iap/v1/src/v1/index.ts create mode 100644 owl-bot-staging/google-cloud-iap/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-iap/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-iap/v1/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-iap/v1/test/gapic_identity_aware_proxy_admin_service_v1.ts create mode 100644 owl-bot-staging/google-cloud-iap/v1/test/gapic_identity_aware_proxy_o_auth_service_v1.ts create mode 100644 owl-bot-staging/google-cloud-iap/v1/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-iap/v1/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-iap/v1beta1/.eslintignore create mode 100644 owl-bot-staging/google-cloud-iap/v1beta1/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-iap/v1beta1/.gitignore create mode 100644 owl-bot-staging/google-cloud-iap/v1beta1/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-iap/v1beta1/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-iap/v1beta1/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-iap/v1beta1/README.md create mode 100644 owl-bot-staging/google-cloud-iap/v1beta1/linkinator.config.json create mode 100644 owl-bot-staging/google-cloud-iap/v1beta1/package.json create mode 100644 owl-bot-staging/google-cloud-iap/v1beta1/protos/google/cloud/iap/v1beta1/service.proto create mode 100644 owl-bot-staging/google-cloud-iap/v1beta1/samples/generated/v1beta1/identity_aware_proxy_admin_v1_beta1.get_iam_policy.js create mode 100644 owl-bot-staging/google-cloud-iap/v1beta1/samples/generated/v1beta1/identity_aware_proxy_admin_v1_beta1.set_iam_policy.js create mode 100644 owl-bot-staging/google-cloud-iap/v1beta1/samples/generated/v1beta1/identity_aware_proxy_admin_v1_beta1.test_iam_permissions.js create mode 100644 owl-bot-staging/google-cloud-iap/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.iap.v1beta1.json create mode 100644 owl-bot-staging/google-cloud-iap/v1beta1/src/index.ts create mode 100644 owl-bot-staging/google-cloud-iap/v1beta1/src/v1beta1/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-iap/v1beta1/src/v1beta1/identity_aware_proxy_admin_v1_beta1_client.ts create mode 100644 owl-bot-staging/google-cloud-iap/v1beta1/src/v1beta1/identity_aware_proxy_admin_v1_beta1_client_config.json create mode 100644 owl-bot-staging/google-cloud-iap/v1beta1/src/v1beta1/identity_aware_proxy_admin_v1_beta1_proto_list.json create mode 100644 owl-bot-staging/google-cloud-iap/v1beta1/src/v1beta1/index.ts create mode 100644 owl-bot-staging/google-cloud-iap/v1beta1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-iap/v1beta1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-iap/v1beta1/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-iap/v1beta1/test/gapic_identity_aware_proxy_admin_v1_beta1_v1beta1.ts create mode 100644 owl-bot-staging/google-cloud-iap/v1beta1/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-iap/v1beta1/webpack.config.js diff --git a/owl-bot-staging/google-cloud-iap/v1/.eslintignore b/owl-bot-staging/google-cloud-iap/v1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-iap/v1/.eslintrc.json b/owl-bot-staging/google-cloud-iap/v1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-iap/v1/.gitignore b/owl-bot-staging/google-cloud-iap/v1/.gitignore new file mode 100644 index 00000000000..5d32b23782f --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/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/google-cloud-iap/v1/.jsdoc.js b/owl-bot-staging/google-cloud-iap/v1/.jsdoc.js new file mode 100644 index 00000000000..c516e1ec527 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/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/iap', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-iap/v1/.mocharc.js b/owl-bot-staging/google-cloud-iap/v1/.mocharc.js new file mode 100644 index 00000000000..481c522b00f --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/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/google-cloud-iap/v1/.prettierrc.js b/owl-bot-staging/google-cloud-iap/v1/.prettierrc.js new file mode 100644 index 00000000000..494e147865d --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/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/google-cloud-iap/v1/README.md b/owl-bot-staging/google-cloud-iap/v1/README.md new file mode 100644 index 00000000000..1ede6beeb65 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1/README.md @@ -0,0 +1 @@ +Iap: Nodejs Client diff --git a/owl-bot-staging/google-cloud-iap/v1/linkinator.config.json b/owl-bot-staging/google-cloud-iap/v1/linkinator.config.json new file mode 100644 index 00000000000..befd23c8633 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/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/google-cloud-iap/v1/package.json b/owl-bot-staging/google-cloud-iap/v1/package.json new file mode 100644 index 00000000000..b8fb0760d5e --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1/package.json @@ -0,0 +1,65 @@ +{ + "name": "@google-cloud/iap", + "version": "0.1.0", + "description": "Iap client for Node.js", + "repository": "googleapis/nodejs-iap", + "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 iap", + "iap", + "identity aware proxy admin service", + "identity aware proxy o auth service" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "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.5.2" + }, + "devDependencies": { + "@types/mocha": "^9.1.1", + "@types/node": "^16.11.62", + "@types/sinon": "^10.0.13", + "c8": "^7.12.0", + "gts": "^3.1.1", + "jsdoc": "^3.6.11", + "jsdoc-fresh": "^2.0.1", + "jsdoc-region-tag": "^2.0.1", + "linkinator": "^4.0.3", + "mocha": "^10.0.0", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^14.0.0", + "ts-loader": "^8.4.0", + "typescript": "^4.8.3", + "webpack": "^4.46.0", + "webpack-cli": "^4.10.0" + }, + "engines": { + "node": ">=v12" + } +} diff --git a/owl-bot-staging/google-cloud-iap/v1/protos/google/cloud/iap/v1/service.proto b/owl-bot-staging/google-cloud-iap/v1/protos/google/cloud/iap/v1/service.proto new file mode 100644 index 00000000000..919009292c4 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1/protos/google/cloud/iap/v1/service.proto @@ -0,0 +1,725 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.iap.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/iam/v1/iam_policy.proto"; +import "google/iam/v1/policy.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/wrappers.proto"; + +option csharp_namespace = "Google.Cloud.Iap.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/iap/v1;iap"; +option java_multiple_files = true; +option java_package = "com.google.cloud.iap.v1"; +option php_namespace = "Google\\Cloud\\Iap\\V1"; +option ruby_package = "Google::Cloud::Iap::V1"; +option (google.api.resource_definition) = { + type: "iap.googleapis.com/TunnelLocation" + pattern: "projects/{project}/iap_tunnel/locations/{location}" +}; + +// The Cloud Identity-Aware Proxy API. + +// APIs for Identity-Aware Proxy Admin configurations. +service IdentityAwareProxyAdminService { + option (google.api.default_host) = "iap.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Sets the access control policy for an Identity-Aware Proxy protected + // resource. Replaces any existing policy. + // More information about managing access via IAP can be found at: + // https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api + rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) + returns (google.iam.v1.Policy) { + option (google.api.http) = { + post: "/v1/{resource=**}:setIamPolicy" + body: "*" + }; + } + + // Gets the access control policy for an Identity-Aware Proxy protected + // resource. + // More information about managing access via IAP can be found at: + // https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api + rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) + returns (google.iam.v1.Policy) { + option (google.api.http) = { + post: "/v1/{resource=**}:getIamPolicy" + body: "*" + }; + } + + // Returns permissions that a caller has on the Identity-Aware Proxy protected + // resource. + // More information about managing access via IAP can be found at: + // https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api + rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) + returns (google.iam.v1.TestIamPermissionsResponse) { + option (google.api.http) = { + post: "/v1/{resource=**}:testIamPermissions" + body: "*" + }; + } + + // Gets the IAP settings on a particular IAP protected resource. + rpc GetIapSettings(GetIapSettingsRequest) returns (IapSettings) { + option (google.api.http) = { + get: "/v1/{name=**}:iapSettings" + }; + } + + // Updates the IAP settings on a particular IAP protected resource. It + // replaces all fields unless the `update_mask` is set. + rpc UpdateIapSettings(UpdateIapSettingsRequest) returns (IapSettings) { + option (google.api.http) = { + patch: "/v1/{iap_settings.name=**}:iapSettings" + body: "iap_settings" + }; + } + + // Lists the existing TunnelDestGroups. To group across all locations, use a + // `-` as the location ID. For example: + // `/v1/projects/123/iap_tunnel/locations/-/destGroups` + rpc ListTunnelDestGroups(ListTunnelDestGroupsRequest) + returns (ListTunnelDestGroupsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/iap_tunnel/locations/*}/destGroups" + }; + option (google.api.method_signature) = "parent"; + } + + // Creates a new TunnelDestGroup. + rpc CreateTunnelDestGroup(CreateTunnelDestGroupRequest) + returns (TunnelDestGroup) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/iap_tunnel/locations/*}/destGroups" + body: "tunnel_dest_group" + }; + option (google.api.method_signature) = + "parent,tunnel_dest_group,tunnel_dest_group_id"; + } + + // Retrieves an existing TunnelDestGroup. + rpc GetTunnelDestGroup(GetTunnelDestGroupRequest) returns (TunnelDestGroup) { + option (google.api.http) = { + get: "/v1/{name=projects/*/iap_tunnel/locations/*/destGroups/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Deletes a TunnelDestGroup. + rpc DeleteTunnelDestGroup(DeleteTunnelDestGroupRequest) + returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/iap_tunnel/locations/*/destGroups/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates a TunnelDestGroup. + rpc UpdateTunnelDestGroup(UpdateTunnelDestGroupRequest) + returns (TunnelDestGroup) { + option (google.api.http) = { + patch: "/v1/{tunnel_dest_group.name=projects/*/iap_tunnel/locations/*/destGroups/*}" + body: "tunnel_dest_group" + }; + option (google.api.method_signature) = "tunnel_dest_group,update_mask"; + } +} + +// The request to ListTunnelDestGroups. +message ListTunnelDestGroupsRequest { + // Required. Google Cloud Project ID and location. + // In the following format: + // `projects/{project_number/id}/iap_tunnel/locations/{location}`. + // A `-` can be used for the location to group across all locations. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "iap.googleapis.com/TunnelLocation" + } + ]; + + // The maximum number of groups to return. The service might return fewer than + // this value. + // If unspecified, at most 100 groups are returned. + // The maximum value is 1000; values above 1000 are coerced to 1000. + int32 page_size = 2; + + // A page token, received from a previous `ListTunnelDestGroups` + // call. Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to + // `ListTunnelDestGroups` must match the call that provided the page + // token. + string page_token = 3; +} + +// The response from ListTunnelDestGroups. +message ListTunnelDestGroupsResponse { + // TunnelDestGroup existing in the project. + repeated TunnelDestGroup tunnel_dest_groups = 1; + + // A token that you can send as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// The request to CreateTunnelDestGroup. +message CreateTunnelDestGroupRequest { + // Required. Google Cloud Project ID and location. + // In the following format: + // `projects/{project_number/id}/iap_tunnel/locations/{location}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "iap.googleapis.com/TunnelDestGroup" + } + ]; + + // Required. The TunnelDestGroup to create. + TunnelDestGroup tunnel_dest_group = 2 + [(google.api.field_behavior) = REQUIRED]; + + // Required. The ID to use for the TunnelDestGroup, which becomes the final + // component of the resource name. + // + // This value must be 4-63 characters, and valid characters + // are `[a-z]-`. + string tunnel_dest_group_id = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// The request to GetTunnelDestGroup. +message GetTunnelDestGroupRequest { + // Required. Name of the TunnelDestGroup to be fetched. + // In the following format: + // `projects/{project_number/id}/iap_tunnel/locations/{location}/destGroups/{dest_group}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "iap.googleapis.com/TunnelDestGroup" + } + ]; +} + +// The request to DeleteTunnelDestGroup. +message DeleteTunnelDestGroupRequest { + // Required. Name of the TunnelDestGroup to delete. + // In the following format: + // `projects/{project_number/id}/iap_tunnel/locations/{location}/destGroups/{dest_group}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "iap.googleapis.com/TunnelDestGroup" + } + ]; +} + +// The request to UpdateTunnelDestGroup. +message UpdateTunnelDestGroupRequest { + // Required. The new values for the TunnelDestGroup. + TunnelDestGroup tunnel_dest_group = 1 + [(google.api.field_behavior) = REQUIRED]; + + // A field mask that specifies which IAP settings to update. + // If omitted, then all of the settings are updated. See + // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + google.protobuf.FieldMask update_mask = 2; +} + +// A TunnelDestGroup. +message TunnelDestGroup { + option (google.api.resource) = { + type: "iap.googleapis.com/TunnelDestGroup" + pattern: "projects/{project}/iap_tunnel/locations/{location}/destGroups/{dest_group}" + }; + + // Required. Immutable. Identifier for the TunnelDestGroup. Must be unique + // within the project and contain only lower case letters (a-z) and dashes + // (-). + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = IMMUTABLE + ]; + + // Unordered list. List of CIDRs that this group applies to. + repeated string cidrs = 2 [(google.api.field_behavior) = UNORDERED_LIST]; + + // Unordered list. List of FQDNs that this group applies to. + repeated string fqdns = 3 [(google.api.field_behavior) = UNORDERED_LIST]; +} + +// The request sent to GetIapSettings. +message GetIapSettingsRequest { + // Required. The resource name for which to retrieve the settings. + // Authorization: Requires the `getSettings` permission for the associated + // resource. + string name = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// The request sent to UpdateIapSettings. +message UpdateIapSettingsRequest { + // Required. The new values for the IAP settings to be updated. + // Authorization: Requires the `updateSettings` permission for the associated + // resource. + IapSettings iap_settings = 1 [(google.api.field_behavior) = REQUIRED]; + + // The field mask specifying which IAP settings should be updated. + // If omitted, the all of the settings are updated. See + // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + google.protobuf.FieldMask update_mask = 2; +} + +// The IAP configurable settings. +message IapSettings { + // Required. The resource name of the IAP protected resource. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Top level wrapper for all access related setting in IAP + AccessSettings access_settings = 5; + + // Top level wrapper for all application related settings in IAP + ApplicationSettings application_settings = 6; +} + +// Access related settings for IAP protected apps. +message AccessSettings { + // GCIP claims and endpoint configurations for 3p identity providers. + GcipSettings gcip_settings = 1; + + // Configuration to allow cross-origin requests via IAP. + CorsSettings cors_settings = 2; + + // Settings to configure IAP's OAuth behavior. + OAuthSettings oauth_settings = 3; + + // Settings to configure reauthentication policies in IAP. + ReauthSettings reauth_settings = 6; + + // Settings to configure and enable allowed domains. + AllowedDomainsSettings allowed_domains_settings = 7; +} + +// Allows customers to configure tenant_id for GCIP instance per-app. +message GcipSettings { + // GCIP tenant ids that are linked to the IAP resource. + // tenant_ids could be a string beginning with a number character to indicate + // authenticating with GCIP tenant flow, or in the format of _ + // to indicate authenticating with GCIP agent flow. + // If agent flow is used, tenant_ids should only contain one single element, + // while for tenant flow, tenant_ids can contain multiple elements. + repeated string tenant_ids = 1; + + // Login page URI associated with the GCIP tenants. + // Typically, all resources within the same project share the same login page, + // though it could be overridden at the sub resource level. + google.protobuf.StringValue login_page_uri = 2; +} + +// Allows customers to configure HTTP request paths that'll allow HTTP OPTIONS +// call to bypass authentication and authorization. +message CorsSettings { + // Configuration to allow HTTP OPTIONS calls to skip authorization. If + // undefined, IAP will not apply any special logic to OPTIONS requests. + google.protobuf.BoolValue allow_http_options = 1; +} + +// Configuration for OAuth login&consent flow behavior as well as for OAuth +// Credentials. +message OAuthSettings { + // Domain hint to send as hd=? parameter in OAuth request flow. Enables + // redirect to primary IDP by skipping Google's login screen. + // https://developers.google.com/identity/protocols/OpenIDConnect#hd-param + // Note: IAP does not verify that the id token's hd claim matches this value + // since access behavior is managed by IAM policies. + google.protobuf.StringValue login_hint = 2; +} + +// Configuration for IAP reauthentication policies. +message ReauthSettings { + // Types of reauthentication methods supported by IAP. + enum Method { + // Reauthentication disabled. + METHOD_UNSPECIFIED = 0; + + // Prompts the user to log in again. + LOGIN = 1; + + // Deprecated, no longer accepted by IAP APIs. + PASSWORD = 2 [deprecated = true]; + + // User must use their secure key 2nd factor device. + SECURE_KEY = 3; + } + + // Type of policy in the case of hierarchial policies. + enum PolicyType { + // Default value. This value is unused. + POLICY_TYPE_UNSPECIFIED = 0; + + // This policy acts as a minimum to other policies, lower in the hierarchy. + // Effective policy may only be the same or stricter. + MINIMUM = 1; + + // This policy acts as a default if no other reauth policy is set. + DEFAULT = 2; + } + + // Reauth method requested. + Method method = 1; + + // Reauth session lifetime, how long before a user has to reauthenticate + // again. + google.protobuf.Duration max_age = 2; + + // How IAP determines the effective policy in cases of hierarchial policies. + // Policies are merged from higher in the hierarchy to lower in the hierarchy. + PolicyType policy_type = 3; +} + +// Configuration for IAP allowed domains. Lets you to restrict access to an app +// and allow access to only the domains that you list. +message AllowedDomainsSettings { + // Configuration for customers to opt in for the feature. + optional bool enable = 1; + + // List of trusted domains. + repeated string domains = 2; +} + +// Wrapper over application specific settings for IAP. +message ApplicationSettings { + // Settings to configure IAP's behavior for a service mesh. + CsmSettings csm_settings = 1; + + // Customization for Access Denied page. + AccessDeniedPageSettings access_denied_page_settings = 2; + + // The Domain value to set for cookies generated by IAP. This value is not + // validated by the API, but will be ignored at runtime if invalid. + google.protobuf.StringValue cookie_domain = 3; + + // Settings to configure attribute propagation. + AttributePropagationSettings attribute_propagation_settings = 4; +} + +// Configuration for RCToken generated for service mesh workloads protected by +// IAP. RCToken are IAP generated JWTs that can be verified at the application. +// The RCToken is primarily used for service mesh deployments, and can be scoped +// to a single mesh by configuring the audience field accordingly. +message CsmSettings { + // Audience claim set in the generated RCToken. This value is not validated by + // IAP. + google.protobuf.StringValue rctoken_aud = 1; +} + +// Custom content configuration for access denied page. +// IAP allows customers to define a custom URI to use as the error page when +// access is denied to users. If IAP prevents access to this page, the default +// IAP error page will be displayed instead. +message AccessDeniedPageSettings { + // The URI to be redirected to when access is denied. + google.protobuf.StringValue access_denied_page_uri = 1; + + // Whether to generate a troubleshooting URL on access denied events to this + // application. + google.protobuf.BoolValue generate_troubleshooting_uri = 2; + + // Whether to generate remediation token on access denied events to this + // application. + optional google.protobuf.BoolValue remediation_token_generation_enabled = 3; +} + +// Configuration for propagating attributes to applications protected +// by IAP. +message AttributePropagationSettings { + // Supported output credentials for attribute propagation. Each output + // credential maps to a "field" in the response. For example, selecting JWT + // will propagate all attributes in the IAP JWT, header in the headers, etc. + enum OutputCredentials { + // No output credential. This is an unsupported default. + OUTPUT_CREDENTIALS_UNSPECIFIED = 0; + + // Propagate attributes in the headers with "x-goog-iap-attr-" prefix. + HEADER = 1; + + // Propagate attributes in the JWT of the form: `"additional_claims": { + // "my_attribute": ["value1", "value2"] }` + JWT = 2; + + // Propagate attributes in the RCToken of the form: `"additional_claims": { + // "my_attribute": ["value1", "value2"] }` + RCTOKEN = 3; + } + + // Raw string CEL expression. Must return a list of attributes. Maximum of 45 + // attributes can be selected. Expressions can select different attribute + // types from `attributes`: `attributes.saml_attributes`, + // `attributes.iap_attributes`. Limited functions are supported: + // - `filter: .filter(, )` -> returns a subset of + // `` where `` is true for every item. + // - `in: in ` -> returns true if `` contains `` + // - `selectByName: .selectByName()` -> returns the attribute + // in + // `` with the given `` name, otherwise returns empty. + // - `emitAs: .emitAs()` -> sets the `` name + // field to the given `` for propagation in selected output + // credentials. + // - `strict: .strict()` -> ignore the `x-goog-iap-attr-` prefix + // for the provided `` when propagating via the `HEADER` output + // credential, i.e. request headers. + // - `append: .append()` OR + // `.append()` -> append the provided `` or + // `` onto the end of ``. + // + // Example expression: `attributes.saml_attributes.filter(x, x.name in + // ['test']).append(attributes.iap_attributes.selectByName('exact').emitAs('custom').strict())` + optional string expression = 1; + + // Which output credentials attributes selected by the CEL expression should + // be propagated in. All attributes will be fully duplicated in each selected + // output credential. + repeated OutputCredentials output_credentials = 2; + + // Whether the provided attribute propagation settings should be evaluated on + // user requests. If set to true, attributes returned from the expression will + // be propagated in the set output credentials. + optional bool enable = 3; +} + +// API to programmatically create, list and retrieve Identity Aware Proxy (IAP) +// OAuth brands; and create, retrieve, delete and reset-secret of IAP OAuth +// clients. +service IdentityAwareProxyOAuthService { + option (google.api.default_host) = "iap.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Lists the existing brands for the project. + rpc ListBrands(ListBrandsRequest) returns (ListBrandsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*}/brands" + }; + } + + // Constructs a new OAuth brand for the project if one does not exist. + // The created brand is "internal only", meaning that OAuth clients created + // under it only accept requests from users who belong to the same Google + // Workspace organization as the project. The brand is created in an + // un-reviewed status. NOTE: The "internal only" status can be manually + // changed in the Google Cloud Console. Requires that a brand does not already + // exist for the project, and that the specified support email is owned by the + // caller. + rpc CreateBrand(CreateBrandRequest) returns (Brand) { + option (google.api.http) = { + post: "/v1/{parent=projects/*}/brands" + body: "brand" + }; + } + + // Retrieves the OAuth brand of the project. + rpc GetBrand(GetBrandRequest) returns (Brand) { + option (google.api.http) = { + get: "/v1/{name=projects/*/brands/*}" + }; + } + + // Creates an Identity Aware Proxy (IAP) OAuth client. The client is owned + // by IAP. Requires that the brand for the project exists and that it is + // set for internal-only use. + rpc CreateIdentityAwareProxyClient(CreateIdentityAwareProxyClientRequest) + returns (IdentityAwareProxyClient) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/brands/*}/identityAwareProxyClients" + body: "identity_aware_proxy_client" + }; + } + + // Lists the existing clients for the brand. + rpc ListIdentityAwareProxyClients(ListIdentityAwareProxyClientsRequest) + returns (ListIdentityAwareProxyClientsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/brands/*}/identityAwareProxyClients" + }; + } + + // Retrieves an Identity Aware Proxy (IAP) OAuth client. + // Requires that the client is owned by IAP. + rpc GetIdentityAwareProxyClient(GetIdentityAwareProxyClientRequest) + returns (IdentityAwareProxyClient) { + option (google.api.http) = { + get: "/v1/{name=projects/*/brands/*/identityAwareProxyClients/*}" + }; + } + + // Resets an Identity Aware Proxy (IAP) OAuth client secret. Useful if the + // secret was compromised. Requires that the client is owned by IAP. + rpc ResetIdentityAwareProxyClientSecret( + ResetIdentityAwareProxyClientSecretRequest) + returns (IdentityAwareProxyClient) { + option (google.api.http) = { + post: "/v1/{name=projects/*/brands/*/identityAwareProxyClients/*}:resetSecret" + body: "*" + }; + } + + // Deletes an Identity Aware Proxy (IAP) OAuth client. Useful for removing + // obsolete clients, managing the number of clients in a given project, and + // cleaning up after tests. Requires that the client is owned by IAP. + rpc DeleteIdentityAwareProxyClient(DeleteIdentityAwareProxyClientRequest) + returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/brands/*/identityAwareProxyClients/*}" + }; + } +} + +// The request sent to ListBrands. +message ListBrandsRequest { + // Required. GCP Project number/id. + // In the following format: projects/{project_number/id}. + string parent = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Response message for ListBrands. +message ListBrandsResponse { + // Brands existing in the project. + repeated Brand brands = 1; +} + +// The request sent to CreateBrand. +message CreateBrandRequest { + // Required. GCP Project number/id under which the brand is to be created. + // In the following format: projects/{project_number/id}. + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The brand to be created. + Brand brand = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request sent to GetBrand. +message GetBrandRequest { + // Required. Name of the brand to be fetched. + // In the following format: projects/{project_number/id}/brands/{brand}. + string name = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// The request sent to ListIdentityAwareProxyClients. +message ListIdentityAwareProxyClientsRequest { + // Required. Full brand path. + // In the following format: projects/{project_number/id}/brands/{brand}. + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // The maximum number of clients to return. The service may return fewer than + // this value. + // If unspecified, at most 100 clients will be returned. + // The maximum value is 1000; values above 1000 will be coerced to 1000. + int32 page_size = 2; + + // A page token, received from a previous `ListIdentityAwareProxyClients` + // call. Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to + // `ListIdentityAwareProxyClients` must match the call that provided the page + // token. + string page_token = 3; +} + +// Response message for ListIdentityAwareProxyClients. +message ListIdentityAwareProxyClientsResponse { + // Clients existing in the brand. + repeated IdentityAwareProxyClient identity_aware_proxy_clients = 1; + + // A token, which can be send as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// The request sent to CreateIdentityAwareProxyClient. +message CreateIdentityAwareProxyClientRequest { + // Required. Path to create the client in. + // In the following format: + // projects/{project_number/id}/brands/{brand}. + // The project must belong to a G Suite account. + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Identity Aware Proxy Client to be created. + IdentityAwareProxyClient identity_aware_proxy_client = 2 + [(google.api.field_behavior) = REQUIRED]; +} + +// The request sent to GetIdentityAwareProxyClient. +message GetIdentityAwareProxyClientRequest { + // Required. Name of the Identity Aware Proxy client to be fetched. + // In the following format: + // projects/{project_number/id}/brands/{brand}/identityAwareProxyClients/{client_id}. + string name = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// The request sent to ResetIdentityAwareProxyClientSecret. +message ResetIdentityAwareProxyClientSecretRequest { + // Required. Name of the Identity Aware Proxy client to that will have its + // secret reset. In the following format: + // projects/{project_number/id}/brands/{brand}/identityAwareProxyClients/{client_id}. + string name = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// The request sent to DeleteIdentityAwareProxyClient. +message DeleteIdentityAwareProxyClientRequest { + // Required. Name of the Identity Aware Proxy client to be deleted. + // In the following format: + // projects/{project_number/id}/brands/{brand}/identityAwareProxyClients/{client_id}. + string name = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// OAuth brand data. +// NOTE: Only contains a portion of the data that describes a brand. +message Brand { + // Output only. Identifier of the brand. + // NOTE: GCP project number achieves the same brand identification purpose as + // only one brand per project can be created. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Support email displayed on the OAuth consent screen. + string support_email = 2; + + // Application name displayed on OAuth consent screen. + string application_title = 3; + + // Output only. Whether the brand is only intended for usage inside the + // G Suite organization only. + bool org_internal_only = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Contains the data that describes an Identity Aware Proxy owned client. +message IdentityAwareProxyClient { + // Output only. Unique identifier of the OAuth client. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Client secret of the OAuth client. + string secret = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Human-friendly name given to the OAuth client. + string display_name = 3; +} diff --git a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.create_tunnel_dest_group.js b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.create_tunnel_dest_group.js new file mode 100644 index 00000000000..65f5a9dbad4 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.create_tunnel_dest_group.js @@ -0,0 +1,76 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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, tunnelDestGroup, tunnelDestGroupId) { + // [START iap_v1_generated_IdentityAwareProxyAdminService_CreateTunnelDestGroup_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Google Cloud Project ID and location. + * In the following format: + * `projects/{project_number/id}/iap_tunnel/locations/{location}`. + */ + // const parent = 'abc123' + /** + * Required. The TunnelDestGroup to create. + */ + // const tunnelDestGroup = {} + /** + * Required. The ID to use for the TunnelDestGroup, which becomes the final + * component of the resource name. + * This value must be 4-63 characters, and valid characters + * are `[a-z]-`. + */ + // const tunnelDestGroupId = 'abc123' + + // Imports the Iap library + const {IdentityAwareProxyAdminServiceClient} = require('@google-cloud/iap').v1; + + // Instantiates a client + const iapClient = new IdentityAwareProxyAdminServiceClient(); + + async function callCreateTunnelDestGroup() { + // Construct request + const request = { + parent, + tunnelDestGroup, + tunnelDestGroupId, + }; + + // Run request + const response = await iapClient.createTunnelDestGroup(request); + console.log(response); + } + + callCreateTunnelDestGroup(); + // [END iap_v1_generated_IdentityAwareProxyAdminService_CreateTunnelDestGroup_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.delete_tunnel_dest_group.js b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.delete_tunnel_dest_group.js new file mode 100644 index 00000000000..2772cd70c2b --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.delete_tunnel_dest_group.js @@ -0,0 +1,63 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 iap_v1_generated_IdentityAwareProxyAdminService_DeleteTunnelDestGroup_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the TunnelDestGroup to delete. + * In the following format: + * `projects/{project_number/id}/iap_tunnel/locations/{location}/destGroups/{dest_group}`. + */ + // const name = 'abc123' + + // Imports the Iap library + const {IdentityAwareProxyAdminServiceClient} = require('@google-cloud/iap').v1; + + // Instantiates a client + const iapClient = new IdentityAwareProxyAdminServiceClient(); + + async function callDeleteTunnelDestGroup() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await iapClient.deleteTunnelDestGroup(request); + console.log(response); + } + + callDeleteTunnelDestGroup(); + // [END iap_v1_generated_IdentityAwareProxyAdminService_DeleteTunnelDestGroup_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.get_iam_policy.js b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.get_iam_policy.js new file mode 100644 index 00000000000..1a961128b5c --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.get_iam_policy.js @@ -0,0 +1,67 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(resource) { + // [START iap_v1_generated_IdentityAwareProxyAdminService_GetIamPolicy_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + */ + // const resource = 'abc123' + /** + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. + */ + // const options = {} + + // Imports the Iap library + const {IdentityAwareProxyAdminServiceClient} = require('@google-cloud/iap').v1; + + // Instantiates a client + const iapClient = new IdentityAwareProxyAdminServiceClient(); + + async function callGetIamPolicy() { + // Construct request + const request = { + resource, + }; + + // Run request + const response = await iapClient.getIamPolicy(request); + console.log(response); + } + + callGetIamPolicy(); + // [END iap_v1_generated_IdentityAwareProxyAdminService_GetIamPolicy_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.get_iap_settings.js b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.get_iap_settings.js new file mode 100644 index 00000000000..f42d62c44eb --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.get_iap_settings.js @@ -0,0 +1,63 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 iap_v1_generated_IdentityAwareProxyAdminService_GetIapSettings_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name for which to retrieve the settings. + * Authorization: Requires the `getSettings` permission for the associated + * resource. + */ + // const name = 'abc123' + + // Imports the Iap library + const {IdentityAwareProxyAdminServiceClient} = require('@google-cloud/iap').v1; + + // Instantiates a client + const iapClient = new IdentityAwareProxyAdminServiceClient(); + + async function callGetIapSettings() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await iapClient.getIapSettings(request); + console.log(response); + } + + callGetIapSettings(); + // [END iap_v1_generated_IdentityAwareProxyAdminService_GetIapSettings_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.get_tunnel_dest_group.js b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.get_tunnel_dest_group.js new file mode 100644 index 00000000000..c7529a0ac56 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.get_tunnel_dest_group.js @@ -0,0 +1,63 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 iap_v1_generated_IdentityAwareProxyAdminService_GetTunnelDestGroup_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the TunnelDestGroup to be fetched. + * In the following format: + * `projects/{project_number/id}/iap_tunnel/locations/{location}/destGroups/{dest_group}`. + */ + // const name = 'abc123' + + // Imports the Iap library + const {IdentityAwareProxyAdminServiceClient} = require('@google-cloud/iap').v1; + + // Instantiates a client + const iapClient = new IdentityAwareProxyAdminServiceClient(); + + async function callGetTunnelDestGroup() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await iapClient.getTunnelDestGroup(request); + console.log(response); + } + + callGetTunnelDestGroup(); + // [END iap_v1_generated_IdentityAwareProxyAdminService_GetTunnelDestGroup_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.list_tunnel_dest_groups.js b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.list_tunnel_dest_groups.js new file mode 100644 index 00000000000..c1b43d8d378 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.list_tunnel_dest_groups.js @@ -0,0 +1,81 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 iap_v1_generated_IdentityAwareProxyAdminService_ListTunnelDestGroups_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Google Cloud Project ID and location. + * In the following format: + * `projects/{project_number/id}/iap_tunnel/locations/{location}`. + * A `-` can be used for the location to group across all locations. + */ + // const parent = 'abc123' + /** + * The maximum number of groups to return. The service might return fewer than + * this value. + * If unspecified, at most 100 groups are returned. + * The maximum value is 1000; values above 1000 are coerced to 1000. + */ + // const pageSize = 1234 + /** + * A page token, received from a previous `ListTunnelDestGroups` + * call. Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListTunnelDestGroups` must match the call that provided the page + * token. + */ + // const pageToken = 'abc123' + + // Imports the Iap library + const {IdentityAwareProxyAdminServiceClient} = require('@google-cloud/iap').v1; + + // Instantiates a client + const iapClient = new IdentityAwareProxyAdminServiceClient(); + + async function callListTunnelDestGroups() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await iapClient.listTunnelDestGroupsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListTunnelDestGroups(); + // [END iap_v1_generated_IdentityAwareProxyAdminService_ListTunnelDestGroups_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.set_iam_policy.js b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.set_iam_policy.js new file mode 100644 index 00000000000..1542add1133 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.set_iam_policy.js @@ -0,0 +1,77 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(resource, policy) { + // [START iap_v1_generated_IdentityAwareProxyAdminService_SetIamPolicy_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * REQUIRED: The resource for which the policy is being specified. + * See the operation documentation for the appropriate value for this field. + */ + // const resource = 'abc123' + /** + * REQUIRED: The complete policy to be applied to the `resource`. The size of + * the policy is limited to a few 10s of KB. An empty policy is a + * valid policy but certain Cloud Platform services (such as Projects) + * might reject them. + */ + // const policy = {} + /** + * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only + * the fields in the mask will be modified. If no mask is provided, the + * following default mask is used: + * `paths: "bindings, etag"` + */ + // const updateMask = {} + + // Imports the Iap library + const {IdentityAwareProxyAdminServiceClient} = require('@google-cloud/iap').v1; + + // Instantiates a client + const iapClient = new IdentityAwareProxyAdminServiceClient(); + + async function callSetIamPolicy() { + // Construct request + const request = { + resource, + policy, + }; + + // Run request + const response = await iapClient.setIamPolicy(request); + console.log(response); + } + + callSetIamPolicy(); + // [END iap_v1_generated_IdentityAwareProxyAdminService_SetIamPolicy_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.test_iam_permissions.js b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.test_iam_permissions.js new file mode 100644 index 00000000000..b0cbaf639ef --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.test_iam_permissions.js @@ -0,0 +1,70 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(resource, permissions) { + // [START iap_v1_generated_IdentityAwareProxyAdminService_TestIamPermissions_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + */ + // const resource = 'abc123' + /** + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * IAM Overview (https://cloud.google.com/iam/docs/overview#permissions). + */ + // const permissions = 'abc123' + + // Imports the Iap library + const {IdentityAwareProxyAdminServiceClient} = require('@google-cloud/iap').v1; + + // Instantiates a client + const iapClient = new IdentityAwareProxyAdminServiceClient(); + + async function callTestIamPermissions() { + // Construct request + const request = { + resource, + permissions, + }; + + // Run request + const response = await iapClient.testIamPermissions(request); + console.log(response); + } + + callTestIamPermissions(); + // [END iap_v1_generated_IdentityAwareProxyAdminService_TestIamPermissions_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.update_iap_settings.js b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.update_iap_settings.js new file mode 100644 index 00000000000..103bb7c575e --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.update_iap_settings.js @@ -0,0 +1,69 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(iapSettings) { + // [START iap_v1_generated_IdentityAwareProxyAdminService_UpdateIapSettings_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The new values for the IAP settings to be updated. + * Authorization: Requires the `updateSettings` permission for the associated + * resource. + */ + // const iapSettings = {} + /** + * The field mask specifying which IAP settings should be updated. + * If omitted, the all of the settings are updated. See + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + */ + // const updateMask = {} + + // Imports the Iap library + const {IdentityAwareProxyAdminServiceClient} = require('@google-cloud/iap').v1; + + // Instantiates a client + const iapClient = new IdentityAwareProxyAdminServiceClient(); + + async function callUpdateIapSettings() { + // Construct request + const request = { + iapSettings, + }; + + // Run request + const response = await iapClient.updateIapSettings(request); + console.log(response); + } + + callUpdateIapSettings(); + // [END iap_v1_generated_IdentityAwareProxyAdminService_UpdateIapSettings_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.update_tunnel_dest_group.js b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.update_tunnel_dest_group.js new file mode 100644 index 00000000000..69af6638533 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.update_tunnel_dest_group.js @@ -0,0 +1,67 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(tunnelDestGroup) { + // [START iap_v1_generated_IdentityAwareProxyAdminService_UpdateTunnelDestGroup_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The new values for the TunnelDestGroup. + */ + // const tunnelDestGroup = {} + /** + * A field mask that specifies which IAP settings to update. + * If omitted, then all of the settings are updated. See + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + */ + // const updateMask = {} + + // Imports the Iap library + const {IdentityAwareProxyAdminServiceClient} = require('@google-cloud/iap').v1; + + // Instantiates a client + const iapClient = new IdentityAwareProxyAdminServiceClient(); + + async function callUpdateTunnelDestGroup() { + // Construct request + const request = { + tunnelDestGroup, + }; + + // Run request + const response = await iapClient.updateTunnelDestGroup(request); + console.log(response); + } + + callUpdateTunnelDestGroup(); + // [END iap_v1_generated_IdentityAwareProxyAdminService_UpdateTunnelDestGroup_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.create_brand.js b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.create_brand.js new file mode 100644 index 00000000000..bf3d1aa108e --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.create_brand.js @@ -0,0 +1,67 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, brand) { + // [START iap_v1_generated_IdentityAwareProxyOAuthService_CreateBrand_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. GCP Project number/id under which the brand is to be created. + * In the following format: projects/{project_number/id}. + */ + // const parent = 'abc123' + /** + * Required. The brand to be created. + */ + // const brand = {} + + // Imports the Iap library + const {IdentityAwareProxyOAuthServiceClient} = require('@google-cloud/iap').v1; + + // Instantiates a client + const iapClient = new IdentityAwareProxyOAuthServiceClient(); + + async function callCreateBrand() { + // Construct request + const request = { + parent, + brand, + }; + + // Run request + const response = await iapClient.createBrand(request); + console.log(response); + } + + callCreateBrand(); + // [END iap_v1_generated_IdentityAwareProxyOAuthService_CreateBrand_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.create_identity_aware_proxy_client.js b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.create_identity_aware_proxy_client.js new file mode 100644 index 00000000000..b8f1a811679 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.create_identity_aware_proxy_client.js @@ -0,0 +1,69 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, identityAwareProxyClient) { + // [START iap_v1_generated_IdentityAwareProxyOAuthService_CreateIdentityAwareProxyClient_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Path to create the client in. + * In the following format: + * projects/{project_number/id}/brands/{brand}. + * The project must belong to a G Suite account. + */ + // const parent = 'abc123' + /** + * Required. Identity Aware Proxy Client to be created. + */ + // const identityAwareProxyClient = {} + + // Imports the Iap library + const {IdentityAwareProxyOAuthServiceClient} = require('@google-cloud/iap').v1; + + // Instantiates a client + const iapClient = new IdentityAwareProxyOAuthServiceClient(); + + async function callCreateIdentityAwareProxyClient() { + // Construct request + const request = { + parent, + identityAwareProxyClient, + }; + + // Run request + const response = await iapClient.createIdentityAwareProxyClient(request); + console.log(response); + } + + callCreateIdentityAwareProxyClient(); + // [END iap_v1_generated_IdentityAwareProxyOAuthService_CreateIdentityAwareProxyClient_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.delete_identity_aware_proxy_client.js b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.delete_identity_aware_proxy_client.js new file mode 100644 index 00000000000..986824a094a --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.delete_identity_aware_proxy_client.js @@ -0,0 +1,63 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 iap_v1_generated_IdentityAwareProxyOAuthService_DeleteIdentityAwareProxyClient_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the Identity Aware Proxy client to be deleted. + * In the following format: + * projects/{project_number/id}/brands/{brand}/identityAwareProxyClients/{client_id}. + */ + // const name = 'abc123' + + // Imports the Iap library + const {IdentityAwareProxyOAuthServiceClient} = require('@google-cloud/iap').v1; + + // Instantiates a client + const iapClient = new IdentityAwareProxyOAuthServiceClient(); + + async function callDeleteIdentityAwareProxyClient() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await iapClient.deleteIdentityAwareProxyClient(request); + console.log(response); + } + + callDeleteIdentityAwareProxyClient(); + // [END iap_v1_generated_IdentityAwareProxyOAuthService_DeleteIdentityAwareProxyClient_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.get_brand.js b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.get_brand.js new file mode 100644 index 00000000000..862cbb4a432 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.get_brand.js @@ -0,0 +1,62 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START iap_v1_generated_IdentityAwareProxyOAuthService_GetBrand_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the brand to be fetched. + * In the following format: projects/{project_number/id}/brands/{brand}. + */ + // const name = 'abc123' + + // Imports the Iap library + const {IdentityAwareProxyOAuthServiceClient} = require('@google-cloud/iap').v1; + + // Instantiates a client + const iapClient = new IdentityAwareProxyOAuthServiceClient(); + + async function callGetBrand() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await iapClient.getBrand(request); + console.log(response); + } + + callGetBrand(); + // [END iap_v1_generated_IdentityAwareProxyOAuthService_GetBrand_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.get_identity_aware_proxy_client.js b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.get_identity_aware_proxy_client.js new file mode 100644 index 00000000000..1d4272ebf0b --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.get_identity_aware_proxy_client.js @@ -0,0 +1,63 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 iap_v1_generated_IdentityAwareProxyOAuthService_GetIdentityAwareProxyClient_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the Identity Aware Proxy client to be fetched. + * In the following format: + * projects/{project_number/id}/brands/{brand}/identityAwareProxyClients/{client_id}. + */ + // const name = 'abc123' + + // Imports the Iap library + const {IdentityAwareProxyOAuthServiceClient} = require('@google-cloud/iap').v1; + + // Instantiates a client + const iapClient = new IdentityAwareProxyOAuthServiceClient(); + + async function callGetIdentityAwareProxyClient() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await iapClient.getIdentityAwareProxyClient(request); + console.log(response); + } + + callGetIdentityAwareProxyClient(); + // [END iap_v1_generated_IdentityAwareProxyOAuthService_GetIdentityAwareProxyClient_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.list_brands.js b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.list_brands.js new file mode 100644 index 00000000000..bb928480edc --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.list_brands.js @@ -0,0 +1,62 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START iap_v1_generated_IdentityAwareProxyOAuthService_ListBrands_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. GCP Project number/id. + * In the following format: projects/{project_number/id}. + */ + // const parent = 'abc123' + + // Imports the Iap library + const {IdentityAwareProxyOAuthServiceClient} = require('@google-cloud/iap').v1; + + // Instantiates a client + const iapClient = new IdentityAwareProxyOAuthServiceClient(); + + async function callListBrands() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await iapClient.listBrands(request); + console.log(response); + } + + callListBrands(); + // [END iap_v1_generated_IdentityAwareProxyOAuthService_ListBrands_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.list_identity_aware_proxy_clients.js b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.list_identity_aware_proxy_clients.js new file mode 100644 index 00000000000..327eebde765 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.list_identity_aware_proxy_clients.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(parent) { + // [START iap_v1_generated_IdentityAwareProxyOAuthService_ListIdentityAwareProxyClients_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Full brand path. + * In the following format: projects/{project_number/id}/brands/{brand}. + */ + // const parent = 'abc123' + /** + * The maximum number of clients to return. The service may return fewer than + * this value. + * If unspecified, at most 100 clients will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + */ + // const pageSize = 1234 + /** + * A page token, received from a previous `ListIdentityAwareProxyClients` + * call. Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListIdentityAwareProxyClients` must match the call that provided the page + * token. + */ + // const pageToken = 'abc123' + + // Imports the Iap library + const {IdentityAwareProxyOAuthServiceClient} = require('@google-cloud/iap').v1; + + // Instantiates a client + const iapClient = new IdentityAwareProxyOAuthServiceClient(); + + async function callListIdentityAwareProxyClients() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await iapClient.listIdentityAwareProxyClientsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListIdentityAwareProxyClients(); + // [END iap_v1_generated_IdentityAwareProxyOAuthService_ListIdentityAwareProxyClients_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.reset_identity_aware_proxy_client_secret.js b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.reset_identity_aware_proxy_client_secret.js new file mode 100644 index 00000000000..996902dce5f --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.reset_identity_aware_proxy_client_secret.js @@ -0,0 +1,63 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 iap_v1_generated_IdentityAwareProxyOAuthService_ResetIdentityAwareProxyClientSecret_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the Identity Aware Proxy client to that will have its + * secret reset. In the following format: + * projects/{project_number/id}/brands/{brand}/identityAwareProxyClients/{client_id}. + */ + // const name = 'abc123' + + // Imports the Iap library + const {IdentityAwareProxyOAuthServiceClient} = require('@google-cloud/iap').v1; + + // Instantiates a client + const iapClient = new IdentityAwareProxyOAuthServiceClient(); + + async function callResetIdentityAwareProxyClientSecret() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await iapClient.resetIdentityAwareProxyClientSecret(request); + console.log(response); + } + + callResetIdentityAwareProxyClientSecret(); + // [END iap_v1_generated_IdentityAwareProxyOAuthService_ResetIdentityAwareProxyClientSecret_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/snippet_metadata.google.cloud.iap.v1.json b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/snippet_metadata.google.cloud.iap.v1.json new file mode 100644 index 00000000000..bbcaf63c5c7 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/snippet_metadata.google.cloud.iap.v1.json @@ -0,0 +1,791 @@ +{ + "clientLibrary": { + "name": "nodejs-iap", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.iap.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "iap_v1_generated_IdentityAwareProxyAdminService_SetIamPolicy_async", + "title": "IdentityAwareProxyAdminService setIamPolicy Sample", + "origin": "API_DEFINITION", + "description": " Sets the access control policy for an Identity-Aware Proxy protected resource. Replaces any existing policy. More information about managing access via IAP can be found at: https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api", + "canonical": true, + "file": "identity_aware_proxy_admin_service.set_iam_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetIamPolicy", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService.SetIamPolicy", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "policy", + "type": ".google.iam.v1.Policy" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.iam.v1.Policy", + "client": { + "shortName": "IdentityAwareProxyAdminServiceClient", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminServiceClient" + }, + "method": { + "shortName": "SetIamPolicy", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService.SetIamPolicy", + "service": { + "shortName": "IdentityAwareProxyAdminService", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService" + } + } + } + }, + { + "regionTag": "iap_v1_generated_IdentityAwareProxyAdminService_GetIamPolicy_async", + "title": "IdentityAwareProxyAdminService getIamPolicy Sample", + "origin": "API_DEFINITION", + "description": " Gets the access control policy for an Identity-Aware Proxy protected resource. More information about managing access via IAP can be found at: https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api", + "canonical": true, + "file": "identity_aware_proxy_admin_service.get_iam_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetIamPolicy", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService.GetIamPolicy", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "options", + "type": ".google.iam.v1.GetPolicyOptions" + } + ], + "resultType": ".google.iam.v1.Policy", + "client": { + "shortName": "IdentityAwareProxyAdminServiceClient", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminServiceClient" + }, + "method": { + "shortName": "GetIamPolicy", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService.GetIamPolicy", + "service": { + "shortName": "IdentityAwareProxyAdminService", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService" + } + } + } + }, + { + "regionTag": "iap_v1_generated_IdentityAwareProxyAdminService_TestIamPermissions_async", + "title": "IdentityAwareProxyAdminService testIamPermissions Sample", + "origin": "API_DEFINITION", + "description": " Returns permissions that a caller has on the Identity-Aware Proxy protected resource. More information about managing access via IAP can be found at: https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api", + "canonical": true, + "file": "identity_aware_proxy_admin_service.test_iam_permissions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "TestIamPermissions", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService.TestIamPermissions", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "permissions", + "type": "TYPE_STRING[]" + } + ], + "resultType": ".google.iam.v1.TestIamPermissionsResponse", + "client": { + "shortName": "IdentityAwareProxyAdminServiceClient", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminServiceClient" + }, + "method": { + "shortName": "TestIamPermissions", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService.TestIamPermissions", + "service": { + "shortName": "IdentityAwareProxyAdminService", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService" + } + } + } + }, + { + "regionTag": "iap_v1_generated_IdentityAwareProxyAdminService_GetIapSettings_async", + "title": "IdentityAwareProxyAdminService getIapSettings Sample", + "origin": "API_DEFINITION", + "description": " Gets the IAP settings on a particular IAP protected resource.", + "canonical": true, + "file": "identity_aware_proxy_admin_service.get_iap_settings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetIapSettings", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService.GetIapSettings", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.iap.v1.IapSettings", + "client": { + "shortName": "IdentityAwareProxyAdminServiceClient", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminServiceClient" + }, + "method": { + "shortName": "GetIapSettings", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService.GetIapSettings", + "service": { + "shortName": "IdentityAwareProxyAdminService", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService" + } + } + } + }, + { + "regionTag": "iap_v1_generated_IdentityAwareProxyAdminService_UpdateIapSettings_async", + "title": "IdentityAwareProxyAdminService updateIapSettings Sample", + "origin": "API_DEFINITION", + "description": " Updates the IAP settings on a particular IAP protected resource. It replaces all fields unless the `update_mask` is set.", + "canonical": true, + "file": "identity_aware_proxy_admin_service.update_iap_settings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateIapSettings", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService.UpdateIapSettings", + "async": true, + "parameters": [ + { + "name": "iap_settings", + "type": ".google.cloud.iap.v1.IapSettings" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.iap.v1.IapSettings", + "client": { + "shortName": "IdentityAwareProxyAdminServiceClient", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminServiceClient" + }, + "method": { + "shortName": "UpdateIapSettings", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService.UpdateIapSettings", + "service": { + "shortName": "IdentityAwareProxyAdminService", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService" + } + } + } + }, + { + "regionTag": "iap_v1_generated_IdentityAwareProxyAdminService_ListTunnelDestGroups_async", + "title": "IdentityAwareProxyAdminService listTunnelDestGroups Sample", + "origin": "API_DEFINITION", + "description": " Lists the existing TunnelDestGroups. To group across all locations, use a `-` as the location ID. For example: `/v1/projects/123/iap_tunnel/locations/-/destGroups`", + "canonical": true, + "file": "identity_aware_proxy_admin_service.list_tunnel_dest_groups.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 73, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListTunnelDestGroups", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService.ListTunnelDestGroups", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.iap.v1.ListTunnelDestGroupsResponse", + "client": { + "shortName": "IdentityAwareProxyAdminServiceClient", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminServiceClient" + }, + "method": { + "shortName": "ListTunnelDestGroups", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService.ListTunnelDestGroups", + "service": { + "shortName": "IdentityAwareProxyAdminService", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService" + } + } + } + }, + { + "regionTag": "iap_v1_generated_IdentityAwareProxyAdminService_CreateTunnelDestGroup_async", + "title": "IdentityAwareProxyAdminService createTunnelDestGroup Sample", + "origin": "API_DEFINITION", + "description": " Creates a new TunnelDestGroup.", + "canonical": true, + "file": "identity_aware_proxy_admin_service.create_tunnel_dest_group.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateTunnelDestGroup", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService.CreateTunnelDestGroup", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "tunnel_dest_group", + "type": ".google.cloud.iap.v1.TunnelDestGroup" + }, + { + "name": "tunnel_dest_group_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.iap.v1.TunnelDestGroup", + "client": { + "shortName": "IdentityAwareProxyAdminServiceClient", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminServiceClient" + }, + "method": { + "shortName": "CreateTunnelDestGroup", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService.CreateTunnelDestGroup", + "service": { + "shortName": "IdentityAwareProxyAdminService", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService" + } + } + } + }, + { + "regionTag": "iap_v1_generated_IdentityAwareProxyAdminService_GetTunnelDestGroup_async", + "title": "IdentityAwareProxyAdminService getTunnelDestGroup Sample", + "origin": "API_DEFINITION", + "description": " Retrieves an existing TunnelDestGroup.", + "canonical": true, + "file": "identity_aware_proxy_admin_service.get_tunnel_dest_group.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetTunnelDestGroup", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService.GetTunnelDestGroup", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.iap.v1.TunnelDestGroup", + "client": { + "shortName": "IdentityAwareProxyAdminServiceClient", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminServiceClient" + }, + "method": { + "shortName": "GetTunnelDestGroup", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService.GetTunnelDestGroup", + "service": { + "shortName": "IdentityAwareProxyAdminService", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService" + } + } + } + }, + { + "regionTag": "iap_v1_generated_IdentityAwareProxyAdminService_DeleteTunnelDestGroup_async", + "title": "IdentityAwareProxyAdminService deleteTunnelDestGroup Sample", + "origin": "API_DEFINITION", + "description": " Deletes a TunnelDestGroup.", + "canonical": true, + "file": "identity_aware_proxy_admin_service.delete_tunnel_dest_group.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteTunnelDestGroup", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService.DeleteTunnelDestGroup", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "IdentityAwareProxyAdminServiceClient", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminServiceClient" + }, + "method": { + "shortName": "DeleteTunnelDestGroup", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService.DeleteTunnelDestGroup", + "service": { + "shortName": "IdentityAwareProxyAdminService", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService" + } + } + } + }, + { + "regionTag": "iap_v1_generated_IdentityAwareProxyAdminService_UpdateTunnelDestGroup_async", + "title": "IdentityAwareProxyAdminService updateTunnelDestGroup Sample", + "origin": "API_DEFINITION", + "description": " Updates a TunnelDestGroup.", + "canonical": true, + "file": "identity_aware_proxy_admin_service.update_tunnel_dest_group.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateTunnelDestGroup", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService.UpdateTunnelDestGroup", + "async": true, + "parameters": [ + { + "name": "tunnel_dest_group", + "type": ".google.cloud.iap.v1.TunnelDestGroup" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.iap.v1.TunnelDestGroup", + "client": { + "shortName": "IdentityAwareProxyAdminServiceClient", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminServiceClient" + }, + "method": { + "shortName": "UpdateTunnelDestGroup", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService.UpdateTunnelDestGroup", + "service": { + "shortName": "IdentityAwareProxyAdminService", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService" + } + } + } + }, + { + "regionTag": "iap_v1_generated_IdentityAwareProxyOAuthService_ListBrands_async", + "title": "IdentityAwareProxyAdminService listBrands Sample", + "origin": "API_DEFINITION", + "description": " Lists the existing brands for the project.", + "canonical": true, + "file": "identity_aware_proxy_o_auth_service.list_brands.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListBrands", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthService.ListBrands", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.iap.v1.ListBrandsResponse", + "client": { + "shortName": "IdentityAwareProxyOAuthServiceClient", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthServiceClient" + }, + "method": { + "shortName": "ListBrands", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthService.ListBrands", + "service": { + "shortName": "IdentityAwareProxyOAuthService", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthService" + } + } + } + }, + { + "regionTag": "iap_v1_generated_IdentityAwareProxyOAuthService_CreateBrand_async", + "title": "IdentityAwareProxyAdminService createBrand Sample", + "origin": "API_DEFINITION", + "description": " Constructs a new OAuth brand for the project if one does not exist. The created brand is \"internal only\", meaning that OAuth clients created under it only accept requests from users who belong to the same Google Workspace organization as the project. The brand is created in an un-reviewed status. NOTE: The \"internal only\" status can be manually changed in the Google Cloud Console. Requires that a brand does not already exist for the project, and that the specified support email is owned by the caller.", + "canonical": true, + "file": "identity_aware_proxy_o_auth_service.create_brand.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateBrand", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthService.CreateBrand", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "brand", + "type": ".google.cloud.iap.v1.Brand" + } + ], + "resultType": ".google.cloud.iap.v1.Brand", + "client": { + "shortName": "IdentityAwareProxyOAuthServiceClient", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthServiceClient" + }, + "method": { + "shortName": "CreateBrand", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthService.CreateBrand", + "service": { + "shortName": "IdentityAwareProxyOAuthService", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthService" + } + } + } + }, + { + "regionTag": "iap_v1_generated_IdentityAwareProxyOAuthService_GetBrand_async", + "title": "IdentityAwareProxyAdminService getBrand Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the OAuth brand of the project.", + "canonical": true, + "file": "identity_aware_proxy_o_auth_service.get_brand.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetBrand", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthService.GetBrand", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.iap.v1.Brand", + "client": { + "shortName": "IdentityAwareProxyOAuthServiceClient", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthServiceClient" + }, + "method": { + "shortName": "GetBrand", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthService.GetBrand", + "service": { + "shortName": "IdentityAwareProxyOAuthService", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthService" + } + } + } + }, + { + "regionTag": "iap_v1_generated_IdentityAwareProxyOAuthService_CreateIdentityAwareProxyClient_async", + "title": "IdentityAwareProxyAdminService createIdentityAwareProxyClient Sample", + "origin": "API_DEFINITION", + "description": " Creates an Identity Aware Proxy (IAP) OAuth client. The client is owned by IAP. Requires that the brand for the project exists and that it is set for internal-only use.", + "canonical": true, + "file": "identity_aware_proxy_o_auth_service.create_identity_aware_proxy_client.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateIdentityAwareProxyClient", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthService.CreateIdentityAwareProxyClient", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "identity_aware_proxy_client", + "type": ".google.cloud.iap.v1.IdentityAwareProxyClient" + } + ], + "resultType": ".google.cloud.iap.v1.IdentityAwareProxyClient", + "client": { + "shortName": "IdentityAwareProxyOAuthServiceClient", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthServiceClient" + }, + "method": { + "shortName": "CreateIdentityAwareProxyClient", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthService.CreateIdentityAwareProxyClient", + "service": { + "shortName": "IdentityAwareProxyOAuthService", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthService" + } + } + } + }, + { + "regionTag": "iap_v1_generated_IdentityAwareProxyOAuthService_ListIdentityAwareProxyClients_async", + "title": "IdentityAwareProxyAdminService listIdentityAwareProxyClients Sample", + "origin": "API_DEFINITION", + "description": " Lists the existing clients for the brand.", + "canonical": true, + "file": "identity_aware_proxy_o_auth_service.list_identity_aware_proxy_clients.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListIdentityAwareProxyClients", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthService.ListIdentityAwareProxyClients", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.iap.v1.ListIdentityAwareProxyClientsResponse", + "client": { + "shortName": "IdentityAwareProxyOAuthServiceClient", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthServiceClient" + }, + "method": { + "shortName": "ListIdentityAwareProxyClients", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthService.ListIdentityAwareProxyClients", + "service": { + "shortName": "IdentityAwareProxyOAuthService", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthService" + } + } + } + }, + { + "regionTag": "iap_v1_generated_IdentityAwareProxyOAuthService_GetIdentityAwareProxyClient_async", + "title": "IdentityAwareProxyAdminService getIdentityAwareProxyClient Sample", + "origin": "API_DEFINITION", + "description": " Retrieves an Identity Aware Proxy (IAP) OAuth client. Requires that the client is owned by IAP.", + "canonical": true, + "file": "identity_aware_proxy_o_auth_service.get_identity_aware_proxy_client.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetIdentityAwareProxyClient", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthService.GetIdentityAwareProxyClient", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.iap.v1.IdentityAwareProxyClient", + "client": { + "shortName": "IdentityAwareProxyOAuthServiceClient", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthServiceClient" + }, + "method": { + "shortName": "GetIdentityAwareProxyClient", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthService.GetIdentityAwareProxyClient", + "service": { + "shortName": "IdentityAwareProxyOAuthService", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthService" + } + } + } + }, + { + "regionTag": "iap_v1_generated_IdentityAwareProxyOAuthService_ResetIdentityAwareProxyClientSecret_async", + "title": "IdentityAwareProxyAdminService resetIdentityAwareProxyClientSecret Sample", + "origin": "API_DEFINITION", + "description": " Resets an Identity Aware Proxy (IAP) OAuth client secret. Useful if the secret was compromised. Requires that the client is owned by IAP.", + "canonical": true, + "file": "identity_aware_proxy_o_auth_service.reset_identity_aware_proxy_client_secret.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ResetIdentityAwareProxyClientSecret", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthService.ResetIdentityAwareProxyClientSecret", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.iap.v1.IdentityAwareProxyClient", + "client": { + "shortName": "IdentityAwareProxyOAuthServiceClient", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthServiceClient" + }, + "method": { + "shortName": "ResetIdentityAwareProxyClientSecret", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthService.ResetIdentityAwareProxyClientSecret", + "service": { + "shortName": "IdentityAwareProxyOAuthService", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthService" + } + } + } + }, + { + "regionTag": "iap_v1_generated_IdentityAwareProxyOAuthService_DeleteIdentityAwareProxyClient_async", + "title": "IdentityAwareProxyAdminService deleteIdentityAwareProxyClient Sample", + "origin": "API_DEFINITION", + "description": " Deletes an Identity Aware Proxy (IAP) OAuth client. Useful for removing obsolete clients, managing the number of clients in a given project, and cleaning up after tests. Requires that the client is owned by IAP.", + "canonical": true, + "file": "identity_aware_proxy_o_auth_service.delete_identity_aware_proxy_client.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteIdentityAwareProxyClient", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthService.DeleteIdentityAwareProxyClient", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "IdentityAwareProxyOAuthServiceClient", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthServiceClient" + }, + "method": { + "shortName": "DeleteIdentityAwareProxyClient", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthService.DeleteIdentityAwareProxyClient", + "service": { + "shortName": "IdentityAwareProxyOAuthService", + "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthService" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-iap/v1/src/index.ts b/owl-bot-staging/google-cloud-iap/v1/src/index.ts new file mode 100644 index 00000000000..c888a735188 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1/src/index.ts @@ -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. ** + +import * as v1 from './v1'; +const IdentityAwareProxyAdminServiceClient = v1.IdentityAwareProxyAdminServiceClient; +type IdentityAwareProxyAdminServiceClient = v1.IdentityAwareProxyAdminServiceClient; +const IdentityAwareProxyOAuthServiceClient = v1.IdentityAwareProxyOAuthServiceClient; +type IdentityAwareProxyOAuthServiceClient = v1.IdentityAwareProxyOAuthServiceClient; +export {v1, IdentityAwareProxyAdminServiceClient, IdentityAwareProxyOAuthServiceClient}; +export default {v1, IdentityAwareProxyAdminServiceClient, IdentityAwareProxyOAuthServiceClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-iap/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-iap/v1/src/v1/gapic_metadata.json new file mode 100644 index 00000000000..107c46d00a9 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1/src/v1/gapic_metadata.json @@ -0,0 +1,225 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.iap.v1", + "libraryPackage": "@google-cloud/iap", + "services": { + "IdentityAwareProxyAdminService": { + "clients": { + "grpc": { + "libraryClient": "IdentityAwareProxyAdminServiceClient", + "rpcs": { + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + }, + "GetIapSettings": { + "methods": [ + "getIapSettings" + ] + }, + "UpdateIapSettings": { + "methods": [ + "updateIapSettings" + ] + }, + "CreateTunnelDestGroup": { + "methods": [ + "createTunnelDestGroup" + ] + }, + "GetTunnelDestGroup": { + "methods": [ + "getTunnelDestGroup" + ] + }, + "DeleteTunnelDestGroup": { + "methods": [ + "deleteTunnelDestGroup" + ] + }, + "UpdateTunnelDestGroup": { + "methods": [ + "updateTunnelDestGroup" + ] + }, + "ListTunnelDestGroups": { + "methods": [ + "listTunnelDestGroups", + "listTunnelDestGroupsStream", + "listTunnelDestGroupsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "IdentityAwareProxyAdminServiceClient", + "rpcs": { + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + }, + "GetIapSettings": { + "methods": [ + "getIapSettings" + ] + }, + "UpdateIapSettings": { + "methods": [ + "updateIapSettings" + ] + }, + "CreateTunnelDestGroup": { + "methods": [ + "createTunnelDestGroup" + ] + }, + "GetTunnelDestGroup": { + "methods": [ + "getTunnelDestGroup" + ] + }, + "DeleteTunnelDestGroup": { + "methods": [ + "deleteTunnelDestGroup" + ] + }, + "UpdateTunnelDestGroup": { + "methods": [ + "updateTunnelDestGroup" + ] + }, + "ListTunnelDestGroups": { + "methods": [ + "listTunnelDestGroups", + "listTunnelDestGroupsStream", + "listTunnelDestGroupsAsync" + ] + } + } + } + } + }, + "IdentityAwareProxyOAuthService": { + "clients": { + "grpc": { + "libraryClient": "IdentityAwareProxyOAuthServiceClient", + "rpcs": { + "ListBrands": { + "methods": [ + "listBrands" + ] + }, + "CreateBrand": { + "methods": [ + "createBrand" + ] + }, + "GetBrand": { + "methods": [ + "getBrand" + ] + }, + "CreateIdentityAwareProxyClient": { + "methods": [ + "createIdentityAwareProxyClient" + ] + }, + "GetIdentityAwareProxyClient": { + "methods": [ + "getIdentityAwareProxyClient" + ] + }, + "ResetIdentityAwareProxyClientSecret": { + "methods": [ + "resetIdentityAwareProxyClientSecret" + ] + }, + "DeleteIdentityAwareProxyClient": { + "methods": [ + "deleteIdentityAwareProxyClient" + ] + }, + "ListIdentityAwareProxyClients": { + "methods": [ + "listIdentityAwareProxyClients", + "listIdentityAwareProxyClientsStream", + "listIdentityAwareProxyClientsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "IdentityAwareProxyOAuthServiceClient", + "rpcs": { + "ListBrands": { + "methods": [ + "listBrands" + ] + }, + "CreateBrand": { + "methods": [ + "createBrand" + ] + }, + "GetBrand": { + "methods": [ + "getBrand" + ] + }, + "CreateIdentityAwareProxyClient": { + "methods": [ + "createIdentityAwareProxyClient" + ] + }, + "GetIdentityAwareProxyClient": { + "methods": [ + "getIdentityAwareProxyClient" + ] + }, + "ResetIdentityAwareProxyClientSecret": { + "methods": [ + "resetIdentityAwareProxyClientSecret" + ] + }, + "DeleteIdentityAwareProxyClient": { + "methods": [ + "deleteIdentityAwareProxyClient" + ] + }, + "ListIdentityAwareProxyClients": { + "methods": [ + "listIdentityAwareProxyClients", + "listIdentityAwareProxyClientsStream", + "listIdentityAwareProxyClientsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_admin_service_client.ts b/owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_admin_service_client.ts new file mode 100644 index 00000000000..9814fe9ff11 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_admin_service_client.ts @@ -0,0 +1,1348 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1/identity_aware_proxy_admin_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './identity_aware_proxy_admin_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * APIs for Identity-Aware Proxy Admin configurations. + * @class + * @memberof v1 + */ +export class IdentityAwareProxyAdminServiceClient { + 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}; + identityAwareProxyAdminServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of IdentityAwareProxyAdminServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new IdentityAwareProxyAdminServiceClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof IdentityAwareProxyAdminServiceClient; + 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); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + tunnelDestGroupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/iap_tunnel/locations/{location}/destGroups/{dest_group}' + ), + tunnelLocationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/iap_tunnel/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 = { + listTunnelDestGroups: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'tunnelDestGroups') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.iap.v1.IdentityAwareProxyAdminService', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.identityAwareProxyAdminServiceStub) { + return this.identityAwareProxyAdminServiceStub; + } + + // Put together the "service stub" for + // google.cloud.iap.v1.IdentityAwareProxyAdminService. + this.identityAwareProxyAdminServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.iap.v1.IdentityAwareProxyAdminService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.iap.v1.IdentityAwareProxyAdminService, + 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 identityAwareProxyAdminServiceStubMethods = + ['setIamPolicy', 'getIamPolicy', 'testIamPermissions', 'getIapSettings', 'updateIapSettings', 'listTunnelDestGroups', 'createTunnelDestGroup', 'getTunnelDestGroup', 'deleteTunnelDestGroup', 'updateTunnelDestGroup']; + for (const methodName of identityAwareProxyAdminServiceStubMethods) { + const callPromise = this.identityAwareProxyAdminServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.identityAwareProxyAdminServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'iap.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 'iap.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 -- + // ------------------- +/** + * Sets the access control policy for an Identity-Aware Proxy protected + * resource. Replaces any existing policy. + * More information about managing access via IAP can be found at: + * https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being specified. + * See the operation documentation for the appropriate value for this field. + * @param {google.iam.v1.Policy} request.policy + * REQUIRED: The complete policy to be applied to the `resource`. The size of + * the policy is limited to a few 10s of KB. An empty policy is a + * valid policy but certain Cloud Platform services (such as Projects) + * might reject them. + * @param {google.protobuf.FieldMask} request.updateMask + * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only + * the fields in the mask will be modified. If no mask is provided, the + * following default mask is used: + * + * `paths: "bindings, etag"` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/identity_aware_proxy_admin_service.set_iam_policy.js + * region_tag:iap_v1_generated_IdentityAwareProxyAdminService_SetIamPolicy_async + */ + setIamPolicy( + request?: protos.google.iam.v1.ISetIamPolicyRequest, + options?: CallOptions): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined + ]>; + setIamPolicy( + request: protos.google.iam.v1.ISetIamPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; + setIamPolicy( + request: protos.google.iam.v1.ISetIamPolicyRequest, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; + setIamPolicy( + request?: protos.google.iam.v1.ISetIamPolicyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'resource': request.resource ?? '', + }); + this.initialize(); + return this.innerApiCalls.setIamPolicy(request, options, callback); + } +/** + * Gets the access control policy for an Identity-Aware Proxy protected + * resource. + * More information about managing access via IAP can be found at: + * https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {google.iam.v1.GetPolicyOptions} request.options + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/identity_aware_proxy_admin_service.get_iam_policy.js + * region_tag:iap_v1_generated_IdentityAwareProxyAdminService_GetIamPolicy_async + */ + getIamPolicy( + request?: protos.google.iam.v1.IGetIamPolicyRequest, + options?: CallOptions): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined + ]>; + getIamPolicy( + request: protos.google.iam.v1.IGetIamPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; + getIamPolicy( + request: protos.google.iam.v1.IGetIamPolicyRequest, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; + getIamPolicy( + request?: protos.google.iam.v1.IGetIamPolicyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'resource': request.resource ?? '', + }); + this.initialize(); + return this.innerApiCalls.getIamPolicy(request, options, callback); + } +/** + * Returns permissions that a caller has on the Identity-Aware Proxy protected + * resource. + * More information about managing access via IAP can be found at: + * https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/identity_aware_proxy_admin_service.test_iam_permissions.js + * region_tag:iap_v1_generated_IdentityAwareProxyAdminService_TestIamPermissions_async + */ + testIamPermissions( + request?: protos.google.iam.v1.ITestIamPermissionsRequest, + options?: CallOptions): + Promise<[ + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined + ]>; + testIamPermissions( + request: protos.google.iam.v1.ITestIamPermissionsRequest, + options: CallOptions, + callback: Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>): void; + testIamPermissions( + request: protos.google.iam.v1.ITestIamPermissionsRequest, + callback: Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>): void; + testIamPermissions( + request?: protos.google.iam.v1.ITestIamPermissionsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'resource': request.resource ?? '', + }); + this.initialize(); + return this.innerApiCalls.testIamPermissions(request, options, callback); + } +/** + * Gets the IAP settings on a particular IAP protected resource. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name for which to retrieve the settings. + * Authorization: Requires the `getSettings` permission for the associated + * resource. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [IapSettings]{@link google.cloud.iap.v1.IapSettings}. + * 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/identity_aware_proxy_admin_service.get_iap_settings.js + * region_tag:iap_v1_generated_IdentityAwareProxyAdminService_GetIapSettings_async + */ + getIapSettings( + request?: protos.google.cloud.iap.v1.IGetIapSettingsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.iap.v1.IIapSettings, + protos.google.cloud.iap.v1.IGetIapSettingsRequest|undefined, {}|undefined + ]>; + getIapSettings( + request: protos.google.cloud.iap.v1.IGetIapSettingsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.iap.v1.IIapSettings, + protos.google.cloud.iap.v1.IGetIapSettingsRequest|null|undefined, + {}|null|undefined>): void; + getIapSettings( + request: protos.google.cloud.iap.v1.IGetIapSettingsRequest, + callback: Callback< + protos.google.cloud.iap.v1.IIapSettings, + protos.google.cloud.iap.v1.IGetIapSettingsRequest|null|undefined, + {}|null|undefined>): void; + getIapSettings( + request?: protos.google.cloud.iap.v1.IGetIapSettingsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.iap.v1.IIapSettings, + protos.google.cloud.iap.v1.IGetIapSettingsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.iap.v1.IIapSettings, + protos.google.cloud.iap.v1.IGetIapSettingsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.iap.v1.IIapSettings, + protos.google.cloud.iap.v1.IGetIapSettingsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getIapSettings(request, options, callback); + } +/** + * Updates the IAP settings on a particular IAP protected resource. It + * replaces all fields unless the `update_mask` is set. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.iap.v1.IapSettings} request.iapSettings + * Required. The new values for the IAP settings to be updated. + * Authorization: Requires the `updateSettings` permission for the associated + * resource. + * @param {google.protobuf.FieldMask} request.updateMask + * The field mask specifying which IAP settings should be updated. + * If omitted, the all of the settings are updated. See + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [IapSettings]{@link google.cloud.iap.v1.IapSettings}. + * 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/identity_aware_proxy_admin_service.update_iap_settings.js + * region_tag:iap_v1_generated_IdentityAwareProxyAdminService_UpdateIapSettings_async + */ + updateIapSettings( + request?: protos.google.cloud.iap.v1.IUpdateIapSettingsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.iap.v1.IIapSettings, + protos.google.cloud.iap.v1.IUpdateIapSettingsRequest|undefined, {}|undefined + ]>; + updateIapSettings( + request: protos.google.cloud.iap.v1.IUpdateIapSettingsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.iap.v1.IIapSettings, + protos.google.cloud.iap.v1.IUpdateIapSettingsRequest|null|undefined, + {}|null|undefined>): void; + updateIapSettings( + request: protos.google.cloud.iap.v1.IUpdateIapSettingsRequest, + callback: Callback< + protos.google.cloud.iap.v1.IIapSettings, + protos.google.cloud.iap.v1.IUpdateIapSettingsRequest|null|undefined, + {}|null|undefined>): void; + updateIapSettings( + request?: protos.google.cloud.iap.v1.IUpdateIapSettingsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.iap.v1.IIapSettings, + protos.google.cloud.iap.v1.IUpdateIapSettingsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.iap.v1.IIapSettings, + protos.google.cloud.iap.v1.IUpdateIapSettingsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.iap.v1.IIapSettings, + protos.google.cloud.iap.v1.IUpdateIapSettingsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'iap_settings.name': request.iapSettings!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateIapSettings(request, options, callback); + } +/** + * Creates a new TunnelDestGroup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Google Cloud Project ID and location. + * In the following format: + * `projects/{project_number/id}/iap_tunnel/locations/{location}`. + * @param {google.cloud.iap.v1.TunnelDestGroup} request.tunnelDestGroup + * Required. The TunnelDestGroup to create. + * @param {string} request.tunnelDestGroupId + * Required. The ID to use for the TunnelDestGroup, which becomes the final + * component of the resource name. + * + * This value must be 4-63 characters, and valid characters + * are `[a-z]-`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TunnelDestGroup]{@link google.cloud.iap.v1.TunnelDestGroup}. + * 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/identity_aware_proxy_admin_service.create_tunnel_dest_group.js + * region_tag:iap_v1_generated_IdentityAwareProxyAdminService_CreateTunnelDestGroup_async + */ + createTunnelDestGroup( + request?: protos.google.cloud.iap.v1.ICreateTunnelDestGroupRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.iap.v1.ITunnelDestGroup, + protos.google.cloud.iap.v1.ICreateTunnelDestGroupRequest|undefined, {}|undefined + ]>; + createTunnelDestGroup( + request: protos.google.cloud.iap.v1.ICreateTunnelDestGroupRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.iap.v1.ITunnelDestGroup, + protos.google.cloud.iap.v1.ICreateTunnelDestGroupRequest|null|undefined, + {}|null|undefined>): void; + createTunnelDestGroup( + request: protos.google.cloud.iap.v1.ICreateTunnelDestGroupRequest, + callback: Callback< + protos.google.cloud.iap.v1.ITunnelDestGroup, + protos.google.cloud.iap.v1.ICreateTunnelDestGroupRequest|null|undefined, + {}|null|undefined>): void; + createTunnelDestGroup( + request?: protos.google.cloud.iap.v1.ICreateTunnelDestGroupRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.iap.v1.ITunnelDestGroup, + protos.google.cloud.iap.v1.ICreateTunnelDestGroupRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.iap.v1.ITunnelDestGroup, + protos.google.cloud.iap.v1.ICreateTunnelDestGroupRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.iap.v1.ITunnelDestGroup, + protos.google.cloud.iap.v1.ICreateTunnelDestGroupRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createTunnelDestGroup(request, options, callback); + } +/** + * Retrieves an existing TunnelDestGroup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the TunnelDestGroup to be fetched. + * In the following format: + * `projects/{project_number/id}/iap_tunnel/locations/{location}/destGroups/{dest_group}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TunnelDestGroup]{@link google.cloud.iap.v1.TunnelDestGroup}. + * 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/identity_aware_proxy_admin_service.get_tunnel_dest_group.js + * region_tag:iap_v1_generated_IdentityAwareProxyAdminService_GetTunnelDestGroup_async + */ + getTunnelDestGroup( + request?: protos.google.cloud.iap.v1.IGetTunnelDestGroupRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.iap.v1.ITunnelDestGroup, + protos.google.cloud.iap.v1.IGetTunnelDestGroupRequest|undefined, {}|undefined + ]>; + getTunnelDestGroup( + request: protos.google.cloud.iap.v1.IGetTunnelDestGroupRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.iap.v1.ITunnelDestGroup, + protos.google.cloud.iap.v1.IGetTunnelDestGroupRequest|null|undefined, + {}|null|undefined>): void; + getTunnelDestGroup( + request: protos.google.cloud.iap.v1.IGetTunnelDestGroupRequest, + callback: Callback< + protos.google.cloud.iap.v1.ITunnelDestGroup, + protos.google.cloud.iap.v1.IGetTunnelDestGroupRequest|null|undefined, + {}|null|undefined>): void; + getTunnelDestGroup( + request?: protos.google.cloud.iap.v1.IGetTunnelDestGroupRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.iap.v1.ITunnelDestGroup, + protos.google.cloud.iap.v1.IGetTunnelDestGroupRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.iap.v1.ITunnelDestGroup, + protos.google.cloud.iap.v1.IGetTunnelDestGroupRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.iap.v1.ITunnelDestGroup, + protos.google.cloud.iap.v1.IGetTunnelDestGroupRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getTunnelDestGroup(request, options, callback); + } +/** + * Deletes a TunnelDestGroup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the TunnelDestGroup to delete. + * In the following format: + * `projects/{project_number/id}/iap_tunnel/locations/{location}/destGroups/{dest_group}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/identity_aware_proxy_admin_service.delete_tunnel_dest_group.js + * region_tag:iap_v1_generated_IdentityAwareProxyAdminService_DeleteTunnelDestGroup_async + */ + deleteTunnelDestGroup( + request?: protos.google.cloud.iap.v1.IDeleteTunnelDestGroupRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.iap.v1.IDeleteTunnelDestGroupRequest|undefined, {}|undefined + ]>; + deleteTunnelDestGroup( + request: protos.google.cloud.iap.v1.IDeleteTunnelDestGroupRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.iap.v1.IDeleteTunnelDestGroupRequest|null|undefined, + {}|null|undefined>): void; + deleteTunnelDestGroup( + request: protos.google.cloud.iap.v1.IDeleteTunnelDestGroupRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.iap.v1.IDeleteTunnelDestGroupRequest|null|undefined, + {}|null|undefined>): void; + deleteTunnelDestGroup( + request?: protos.google.cloud.iap.v1.IDeleteTunnelDestGroupRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.iap.v1.IDeleteTunnelDestGroupRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.iap.v1.IDeleteTunnelDestGroupRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.iap.v1.IDeleteTunnelDestGroupRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteTunnelDestGroup(request, options, callback); + } +/** + * Updates a TunnelDestGroup. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.iap.v1.TunnelDestGroup} request.tunnelDestGroup + * Required. The new values for the TunnelDestGroup. + * @param {google.protobuf.FieldMask} request.updateMask + * A field mask that specifies which IAP settings to update. + * If omitted, then all of the settings are updated. See + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [TunnelDestGroup]{@link google.cloud.iap.v1.TunnelDestGroup}. + * 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/identity_aware_proxy_admin_service.update_tunnel_dest_group.js + * region_tag:iap_v1_generated_IdentityAwareProxyAdminService_UpdateTunnelDestGroup_async + */ + updateTunnelDestGroup( + request?: protos.google.cloud.iap.v1.IUpdateTunnelDestGroupRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.iap.v1.ITunnelDestGroup, + protos.google.cloud.iap.v1.IUpdateTunnelDestGroupRequest|undefined, {}|undefined + ]>; + updateTunnelDestGroup( + request: protos.google.cloud.iap.v1.IUpdateTunnelDestGroupRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.iap.v1.ITunnelDestGroup, + protos.google.cloud.iap.v1.IUpdateTunnelDestGroupRequest|null|undefined, + {}|null|undefined>): void; + updateTunnelDestGroup( + request: protos.google.cloud.iap.v1.IUpdateTunnelDestGroupRequest, + callback: Callback< + protos.google.cloud.iap.v1.ITunnelDestGroup, + protos.google.cloud.iap.v1.IUpdateTunnelDestGroupRequest|null|undefined, + {}|null|undefined>): void; + updateTunnelDestGroup( + request?: protos.google.cloud.iap.v1.IUpdateTunnelDestGroupRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.iap.v1.ITunnelDestGroup, + protos.google.cloud.iap.v1.IUpdateTunnelDestGroupRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.iap.v1.ITunnelDestGroup, + protos.google.cloud.iap.v1.IUpdateTunnelDestGroupRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.iap.v1.ITunnelDestGroup, + protos.google.cloud.iap.v1.IUpdateTunnelDestGroupRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'tunnel_dest_group.name': request.tunnelDestGroup!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateTunnelDestGroup(request, options, callback); + } + + /** + * Lists the existing TunnelDestGroups. To group across all locations, use a + * `-` as the location ID. For example: + * `/v1/projects/123/iap_tunnel/locations/-/destGroups` + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Google Cloud Project ID and location. + * In the following format: + * `projects/{project_number/id}/iap_tunnel/locations/{location}`. + * A `-` can be used for the location to group across all locations. + * @param {number} request.pageSize + * The maximum number of groups to return. The service might return fewer than + * this value. + * If unspecified, at most 100 groups are returned. + * The maximum value is 1000; values above 1000 are coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListTunnelDestGroups` + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListTunnelDestGroups` must match the call that provided the page + * token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [TunnelDestGroup]{@link google.cloud.iap.v1.TunnelDestGroup}. + * 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 `listTunnelDestGroupsAsync()` + * 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. + */ + listTunnelDestGroups( + request?: protos.google.cloud.iap.v1.IListTunnelDestGroupsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.iap.v1.ITunnelDestGroup[], + protos.google.cloud.iap.v1.IListTunnelDestGroupsRequest|null, + protos.google.cloud.iap.v1.IListTunnelDestGroupsResponse + ]>; + listTunnelDestGroups( + request: protos.google.cloud.iap.v1.IListTunnelDestGroupsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.iap.v1.IListTunnelDestGroupsRequest, + protos.google.cloud.iap.v1.IListTunnelDestGroupsResponse|null|undefined, + protos.google.cloud.iap.v1.ITunnelDestGroup>): void; + listTunnelDestGroups( + request: protos.google.cloud.iap.v1.IListTunnelDestGroupsRequest, + callback: PaginationCallback< + protos.google.cloud.iap.v1.IListTunnelDestGroupsRequest, + protos.google.cloud.iap.v1.IListTunnelDestGroupsResponse|null|undefined, + protos.google.cloud.iap.v1.ITunnelDestGroup>): void; + listTunnelDestGroups( + request?: protos.google.cloud.iap.v1.IListTunnelDestGroupsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.iap.v1.IListTunnelDestGroupsRequest, + protos.google.cloud.iap.v1.IListTunnelDestGroupsResponse|null|undefined, + protos.google.cloud.iap.v1.ITunnelDestGroup>, + callback?: PaginationCallback< + protos.google.cloud.iap.v1.IListTunnelDestGroupsRequest, + protos.google.cloud.iap.v1.IListTunnelDestGroupsResponse|null|undefined, + protos.google.cloud.iap.v1.ITunnelDestGroup>): + Promise<[ + protos.google.cloud.iap.v1.ITunnelDestGroup[], + protos.google.cloud.iap.v1.IListTunnelDestGroupsRequest|null, + protos.google.cloud.iap.v1.IListTunnelDestGroupsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listTunnelDestGroups(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. Google Cloud Project ID and location. + * In the following format: + * `projects/{project_number/id}/iap_tunnel/locations/{location}`. + * A `-` can be used for the location to group across all locations. + * @param {number} request.pageSize + * The maximum number of groups to return. The service might return fewer than + * this value. + * If unspecified, at most 100 groups are returned. + * The maximum value is 1000; values above 1000 are coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListTunnelDestGroups` + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListTunnelDestGroups` must match the call that provided the page + * token. + * @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 [TunnelDestGroup]{@link google.cloud.iap.v1.TunnelDestGroup} 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 `listTunnelDestGroupsAsync()` + * 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. + */ + listTunnelDestGroupsStream( + request?: protos.google.cloud.iap.v1.IListTunnelDestGroupsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listTunnelDestGroups']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listTunnelDestGroups.createStream( + this.innerApiCalls.listTunnelDestGroups as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listTunnelDestGroups`, 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. Google Cloud Project ID and location. + * In the following format: + * `projects/{project_number/id}/iap_tunnel/locations/{location}`. + * A `-` can be used for the location to group across all locations. + * @param {number} request.pageSize + * The maximum number of groups to return. The service might return fewer than + * this value. + * If unspecified, at most 100 groups are returned. + * The maximum value is 1000; values above 1000 are coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListTunnelDestGroups` + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListTunnelDestGroups` must match the call that provided the 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 + * [TunnelDestGroup]{@link google.cloud.iap.v1.TunnelDestGroup}. 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/identity_aware_proxy_admin_service.list_tunnel_dest_groups.js + * region_tag:iap_v1_generated_IdentityAwareProxyAdminService_ListTunnelDestGroups_async + */ + listTunnelDestGroupsAsync( + request?: protos.google.cloud.iap.v1.IListTunnelDestGroupsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listTunnelDestGroups']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listTunnelDestGroups.asyncIterate( + this.innerApiCalls['listTunnelDestGroups'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified tunnelDestGroup resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} dest_group + * @returns {string} Resource name string. + */ + tunnelDestGroupPath(project:string,location:string,destGroup:string) { + return this.pathTemplates.tunnelDestGroupPathTemplate.render({ + project: project, + location: location, + dest_group: destGroup, + }); + } + + /** + * Parse the project from TunnelDestGroup resource. + * + * @param {string} tunnelDestGroupName + * A fully-qualified path representing TunnelDestGroup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromTunnelDestGroupName(tunnelDestGroupName: string) { + return this.pathTemplates.tunnelDestGroupPathTemplate.match(tunnelDestGroupName).project; + } + + /** + * Parse the location from TunnelDestGroup resource. + * + * @param {string} tunnelDestGroupName + * A fully-qualified path representing TunnelDestGroup resource. + * @returns {string} A string representing the location. + */ + matchLocationFromTunnelDestGroupName(tunnelDestGroupName: string) { + return this.pathTemplates.tunnelDestGroupPathTemplate.match(tunnelDestGroupName).location; + } + + /** + * Parse the dest_group from TunnelDestGroup resource. + * + * @param {string} tunnelDestGroupName + * A fully-qualified path representing TunnelDestGroup resource. + * @returns {string} A string representing the dest_group. + */ + matchDestGroupFromTunnelDestGroupName(tunnelDestGroupName: string) { + return this.pathTemplates.tunnelDestGroupPathTemplate.match(tunnelDestGroupName).dest_group; + } + + /** + * Return a fully-qualified tunnelLocation resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + tunnelLocationPath(project:string,location:string) { + return this.pathTemplates.tunnelLocationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from TunnelLocation resource. + * + * @param {string} tunnelLocationName + * A fully-qualified path representing TunnelLocation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromTunnelLocationName(tunnelLocationName: string) { + return this.pathTemplates.tunnelLocationPathTemplate.match(tunnelLocationName).project; + } + + /** + * Parse the location from TunnelLocation resource. + * + * @param {string} tunnelLocationName + * A fully-qualified path representing TunnelLocation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromTunnelLocationName(tunnelLocationName: string) { + return this.pathTemplates.tunnelLocationPathTemplate.match(tunnelLocationName).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.identityAwareProxyAdminServiceStub && !this._terminated) { + return this.identityAwareProxyAdminServiceStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_admin_service_client_config.json b/owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_admin_service_client_config.json new file mode 100644 index 00000000000..f1329e129a4 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_admin_service_client_config.json @@ -0,0 +1,76 @@ +{ + "interfaces": { + "google.cloud.iap.v1.IdentityAwareProxyAdminService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "SetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "TestIamPermissions": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetIapSettings": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateIapSettings": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListTunnelDestGroups": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateTunnelDestGroup": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetTunnelDestGroup": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteTunnelDestGroup": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateTunnelDestGroup": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_admin_service_proto_list.json b/owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_admin_service_proto_list.json new file mode 100644 index 00000000000..54bf0f1d880 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_admin_service_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/cloud/iap/v1/service.proto" +] diff --git a/owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_o_auth_service_client.ts b/owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_o_auth_service_client.ts new file mode 100644 index 00000000000..0a81839a3f0 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_o_auth_service_client.ts @@ -0,0 +1,1171 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1/identity_aware_proxy_o_auth_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './identity_aware_proxy_o_auth_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * API to programmatically create, list and retrieve Identity Aware Proxy (IAP) + * OAuth brands; and create, retrieve, delete and reset-secret of IAP OAuth + * clients. + * @class + * @memberof v1 + */ +export class IdentityAwareProxyOAuthServiceClient { + 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}; + identityAwareProxyOAuthServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of IdentityAwareProxyOAuthServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new IdentityAwareProxyOAuthServiceClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof IdentityAwareProxyOAuthServiceClient; + 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); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + tunnelDestGroupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/iap_tunnel/locations/{location}/destGroups/{dest_group}' + ), + tunnelLocationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/iap_tunnel/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 = { + listIdentityAwareProxyClients: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'identityAwareProxyClients') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.iap.v1.IdentityAwareProxyOAuthService', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.identityAwareProxyOAuthServiceStub) { + return this.identityAwareProxyOAuthServiceStub; + } + + // Put together the "service stub" for + // google.cloud.iap.v1.IdentityAwareProxyOAuthService. + this.identityAwareProxyOAuthServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.iap.v1.IdentityAwareProxyOAuthService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.iap.v1.IdentityAwareProxyOAuthService, + 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 identityAwareProxyOAuthServiceStubMethods = + ['listBrands', 'createBrand', 'getBrand', 'createIdentityAwareProxyClient', 'listIdentityAwareProxyClients', 'getIdentityAwareProxyClient', 'resetIdentityAwareProxyClientSecret', 'deleteIdentityAwareProxyClient']; + for (const methodName of identityAwareProxyOAuthServiceStubMethods) { + const callPromise = this.identityAwareProxyOAuthServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.identityAwareProxyOAuthServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'iap.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 'iap.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 -- + // ------------------- +/** + * Lists the existing brands for the project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. GCP Project number/id. + * In the following format: projects/{project_number/id}. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ListBrandsResponse]{@link google.cloud.iap.v1.ListBrandsResponse}. + * 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/identity_aware_proxy_o_auth_service.list_brands.js + * region_tag:iap_v1_generated_IdentityAwareProxyOAuthService_ListBrands_async + */ + listBrands( + request?: protos.google.cloud.iap.v1.IListBrandsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.iap.v1.IListBrandsResponse, + protos.google.cloud.iap.v1.IListBrandsRequest|undefined, {}|undefined + ]>; + listBrands( + request: protos.google.cloud.iap.v1.IListBrandsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.iap.v1.IListBrandsResponse, + protos.google.cloud.iap.v1.IListBrandsRequest|null|undefined, + {}|null|undefined>): void; + listBrands( + request: protos.google.cloud.iap.v1.IListBrandsRequest, + callback: Callback< + protos.google.cloud.iap.v1.IListBrandsResponse, + protos.google.cloud.iap.v1.IListBrandsRequest|null|undefined, + {}|null|undefined>): void; + listBrands( + request?: protos.google.cloud.iap.v1.IListBrandsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.iap.v1.IListBrandsResponse, + protos.google.cloud.iap.v1.IListBrandsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.iap.v1.IListBrandsResponse, + protos.google.cloud.iap.v1.IListBrandsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.iap.v1.IListBrandsResponse, + protos.google.cloud.iap.v1.IListBrandsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listBrands(request, options, callback); + } +/** + * Constructs a new OAuth brand for the project if one does not exist. + * The created brand is "internal only", meaning that OAuth clients created + * under it only accept requests from users who belong to the same Google + * Workspace organization as the project. The brand is created in an + * un-reviewed status. NOTE: The "internal only" status can be manually + * changed in the Google Cloud Console. Requires that a brand does not already + * exist for the project, and that the specified support email is owned by the + * caller. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. GCP Project number/id under which the brand is to be created. + * In the following format: projects/{project_number/id}. + * @param {google.cloud.iap.v1.Brand} request.brand + * Required. The brand to be created. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Brand]{@link google.cloud.iap.v1.Brand}. + * 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/identity_aware_proxy_o_auth_service.create_brand.js + * region_tag:iap_v1_generated_IdentityAwareProxyOAuthService_CreateBrand_async + */ + createBrand( + request?: protos.google.cloud.iap.v1.ICreateBrandRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.iap.v1.IBrand, + protos.google.cloud.iap.v1.ICreateBrandRequest|undefined, {}|undefined + ]>; + createBrand( + request: protos.google.cloud.iap.v1.ICreateBrandRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.iap.v1.IBrand, + protos.google.cloud.iap.v1.ICreateBrandRequest|null|undefined, + {}|null|undefined>): void; + createBrand( + request: protos.google.cloud.iap.v1.ICreateBrandRequest, + callback: Callback< + protos.google.cloud.iap.v1.IBrand, + protos.google.cloud.iap.v1.ICreateBrandRequest|null|undefined, + {}|null|undefined>): void; + createBrand( + request?: protos.google.cloud.iap.v1.ICreateBrandRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.iap.v1.IBrand, + protos.google.cloud.iap.v1.ICreateBrandRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.iap.v1.IBrand, + protos.google.cloud.iap.v1.ICreateBrandRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.iap.v1.IBrand, + protos.google.cloud.iap.v1.ICreateBrandRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createBrand(request, options, callback); + } +/** + * Retrieves the OAuth brand of the project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the brand to be fetched. + * In the following format: projects/{project_number/id}/brands/{brand}. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [Brand]{@link google.cloud.iap.v1.Brand}. + * 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/identity_aware_proxy_o_auth_service.get_brand.js + * region_tag:iap_v1_generated_IdentityAwareProxyOAuthService_GetBrand_async + */ + getBrand( + request?: protos.google.cloud.iap.v1.IGetBrandRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.iap.v1.IBrand, + protos.google.cloud.iap.v1.IGetBrandRequest|undefined, {}|undefined + ]>; + getBrand( + request: protos.google.cloud.iap.v1.IGetBrandRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.iap.v1.IBrand, + protos.google.cloud.iap.v1.IGetBrandRequest|null|undefined, + {}|null|undefined>): void; + getBrand( + request: protos.google.cloud.iap.v1.IGetBrandRequest, + callback: Callback< + protos.google.cloud.iap.v1.IBrand, + protos.google.cloud.iap.v1.IGetBrandRequest|null|undefined, + {}|null|undefined>): void; + getBrand( + request?: protos.google.cloud.iap.v1.IGetBrandRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.iap.v1.IBrand, + protos.google.cloud.iap.v1.IGetBrandRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.iap.v1.IBrand, + protos.google.cloud.iap.v1.IGetBrandRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.iap.v1.IBrand, + protos.google.cloud.iap.v1.IGetBrandRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getBrand(request, options, callback); + } +/** + * Creates an Identity Aware Proxy (IAP) OAuth client. The client is owned + * by IAP. Requires that the brand for the project exists and that it is + * set for internal-only use. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Path to create the client in. + * In the following format: + * projects/{project_number/id}/brands/{brand}. + * The project must belong to a G Suite account. + * @param {google.cloud.iap.v1.IdentityAwareProxyClient} request.identityAwareProxyClient + * Required. Identity Aware Proxy Client to be created. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [IdentityAwareProxyClient]{@link google.cloud.iap.v1.IdentityAwareProxyClient}. + * 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/identity_aware_proxy_o_auth_service.create_identity_aware_proxy_client.js + * region_tag:iap_v1_generated_IdentityAwareProxyOAuthService_CreateIdentityAwareProxyClient_async + */ + createIdentityAwareProxyClient( + request?: protos.google.cloud.iap.v1.ICreateIdentityAwareProxyClientRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.iap.v1.IIdentityAwareProxyClient, + protos.google.cloud.iap.v1.ICreateIdentityAwareProxyClientRequest|undefined, {}|undefined + ]>; + createIdentityAwareProxyClient( + request: protos.google.cloud.iap.v1.ICreateIdentityAwareProxyClientRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.iap.v1.IIdentityAwareProxyClient, + protos.google.cloud.iap.v1.ICreateIdentityAwareProxyClientRequest|null|undefined, + {}|null|undefined>): void; + createIdentityAwareProxyClient( + request: protos.google.cloud.iap.v1.ICreateIdentityAwareProxyClientRequest, + callback: Callback< + protos.google.cloud.iap.v1.IIdentityAwareProxyClient, + protos.google.cloud.iap.v1.ICreateIdentityAwareProxyClientRequest|null|undefined, + {}|null|undefined>): void; + createIdentityAwareProxyClient( + request?: protos.google.cloud.iap.v1.ICreateIdentityAwareProxyClientRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.iap.v1.IIdentityAwareProxyClient, + protos.google.cloud.iap.v1.ICreateIdentityAwareProxyClientRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.iap.v1.IIdentityAwareProxyClient, + protos.google.cloud.iap.v1.ICreateIdentityAwareProxyClientRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.iap.v1.IIdentityAwareProxyClient, + protos.google.cloud.iap.v1.ICreateIdentityAwareProxyClientRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createIdentityAwareProxyClient(request, options, callback); + } +/** + * Retrieves an Identity Aware Proxy (IAP) OAuth client. + * Requires that the client is owned by IAP. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the Identity Aware Proxy client to be fetched. + * In the following format: + * projects/{project_number/id}/brands/{brand}/identityAwareProxyClients/{client_id}. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [IdentityAwareProxyClient]{@link google.cloud.iap.v1.IdentityAwareProxyClient}. + * 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/identity_aware_proxy_o_auth_service.get_identity_aware_proxy_client.js + * region_tag:iap_v1_generated_IdentityAwareProxyOAuthService_GetIdentityAwareProxyClient_async + */ + getIdentityAwareProxyClient( + request?: protos.google.cloud.iap.v1.IGetIdentityAwareProxyClientRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.iap.v1.IIdentityAwareProxyClient, + protos.google.cloud.iap.v1.IGetIdentityAwareProxyClientRequest|undefined, {}|undefined + ]>; + getIdentityAwareProxyClient( + request: protos.google.cloud.iap.v1.IGetIdentityAwareProxyClientRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.iap.v1.IIdentityAwareProxyClient, + protos.google.cloud.iap.v1.IGetIdentityAwareProxyClientRequest|null|undefined, + {}|null|undefined>): void; + getIdentityAwareProxyClient( + request: protos.google.cloud.iap.v1.IGetIdentityAwareProxyClientRequest, + callback: Callback< + protos.google.cloud.iap.v1.IIdentityAwareProxyClient, + protos.google.cloud.iap.v1.IGetIdentityAwareProxyClientRequest|null|undefined, + {}|null|undefined>): void; + getIdentityAwareProxyClient( + request?: protos.google.cloud.iap.v1.IGetIdentityAwareProxyClientRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.iap.v1.IIdentityAwareProxyClient, + protos.google.cloud.iap.v1.IGetIdentityAwareProxyClientRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.iap.v1.IIdentityAwareProxyClient, + protos.google.cloud.iap.v1.IGetIdentityAwareProxyClientRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.iap.v1.IIdentityAwareProxyClient, + protos.google.cloud.iap.v1.IGetIdentityAwareProxyClientRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getIdentityAwareProxyClient(request, options, callback); + } +/** + * Resets an Identity Aware Proxy (IAP) OAuth client secret. Useful if the + * secret was compromised. Requires that the client is owned by IAP. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the Identity Aware Proxy client to that will have its + * secret reset. In the following format: + * projects/{project_number/id}/brands/{brand}/identityAwareProxyClients/{client_id}. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [IdentityAwareProxyClient]{@link google.cloud.iap.v1.IdentityAwareProxyClient}. + * 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/identity_aware_proxy_o_auth_service.reset_identity_aware_proxy_client_secret.js + * region_tag:iap_v1_generated_IdentityAwareProxyOAuthService_ResetIdentityAwareProxyClientSecret_async + */ + resetIdentityAwareProxyClientSecret( + request?: protos.google.cloud.iap.v1.IResetIdentityAwareProxyClientSecretRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.iap.v1.IIdentityAwareProxyClient, + protos.google.cloud.iap.v1.IResetIdentityAwareProxyClientSecretRequest|undefined, {}|undefined + ]>; + resetIdentityAwareProxyClientSecret( + request: protos.google.cloud.iap.v1.IResetIdentityAwareProxyClientSecretRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.iap.v1.IIdentityAwareProxyClient, + protos.google.cloud.iap.v1.IResetIdentityAwareProxyClientSecretRequest|null|undefined, + {}|null|undefined>): void; + resetIdentityAwareProxyClientSecret( + request: protos.google.cloud.iap.v1.IResetIdentityAwareProxyClientSecretRequest, + callback: Callback< + protos.google.cloud.iap.v1.IIdentityAwareProxyClient, + protos.google.cloud.iap.v1.IResetIdentityAwareProxyClientSecretRequest|null|undefined, + {}|null|undefined>): void; + resetIdentityAwareProxyClientSecret( + request?: protos.google.cloud.iap.v1.IResetIdentityAwareProxyClientSecretRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.iap.v1.IIdentityAwareProxyClient, + protos.google.cloud.iap.v1.IResetIdentityAwareProxyClientSecretRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.iap.v1.IIdentityAwareProxyClient, + protos.google.cloud.iap.v1.IResetIdentityAwareProxyClientSecretRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.iap.v1.IIdentityAwareProxyClient, + protos.google.cloud.iap.v1.IResetIdentityAwareProxyClientSecretRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.resetIdentityAwareProxyClientSecret(request, options, callback); + } +/** + * Deletes an Identity Aware Proxy (IAP) OAuth client. Useful for removing + * obsolete clients, managing the number of clients in a given project, and + * cleaning up after tests. Requires that the client is owned by IAP. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the Identity Aware Proxy client to be deleted. + * In the following format: + * projects/{project_number/id}/brands/{brand}/identityAwareProxyClients/{client_id}. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/identity_aware_proxy_o_auth_service.delete_identity_aware_proxy_client.js + * region_tag:iap_v1_generated_IdentityAwareProxyOAuthService_DeleteIdentityAwareProxyClient_async + */ + deleteIdentityAwareProxyClient( + request?: protos.google.cloud.iap.v1.IDeleteIdentityAwareProxyClientRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.iap.v1.IDeleteIdentityAwareProxyClientRequest|undefined, {}|undefined + ]>; + deleteIdentityAwareProxyClient( + request: protos.google.cloud.iap.v1.IDeleteIdentityAwareProxyClientRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.iap.v1.IDeleteIdentityAwareProxyClientRequest|null|undefined, + {}|null|undefined>): void; + deleteIdentityAwareProxyClient( + request: protos.google.cloud.iap.v1.IDeleteIdentityAwareProxyClientRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.iap.v1.IDeleteIdentityAwareProxyClientRequest|null|undefined, + {}|null|undefined>): void; + deleteIdentityAwareProxyClient( + request?: protos.google.cloud.iap.v1.IDeleteIdentityAwareProxyClientRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.iap.v1.IDeleteIdentityAwareProxyClientRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.iap.v1.IDeleteIdentityAwareProxyClientRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.iap.v1.IDeleteIdentityAwareProxyClientRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteIdentityAwareProxyClient(request, options, callback); + } + + /** + * Lists the existing clients for the brand. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Full brand path. + * In the following format: projects/{project_number/id}/brands/{brand}. + * @param {number} request.pageSize + * The maximum number of clients to return. The service may return fewer than + * this value. + * If unspecified, at most 100 clients will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListIdentityAwareProxyClients` + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListIdentityAwareProxyClients` must match the call that provided the page + * token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [IdentityAwareProxyClient]{@link google.cloud.iap.v1.IdentityAwareProxyClient}. + * 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 `listIdentityAwareProxyClientsAsync()` + * 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. + */ + listIdentityAwareProxyClients( + request?: protos.google.cloud.iap.v1.IListIdentityAwareProxyClientsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.iap.v1.IIdentityAwareProxyClient[], + protos.google.cloud.iap.v1.IListIdentityAwareProxyClientsRequest|null, + protos.google.cloud.iap.v1.IListIdentityAwareProxyClientsResponse + ]>; + listIdentityAwareProxyClients( + request: protos.google.cloud.iap.v1.IListIdentityAwareProxyClientsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.iap.v1.IListIdentityAwareProxyClientsRequest, + protos.google.cloud.iap.v1.IListIdentityAwareProxyClientsResponse|null|undefined, + protos.google.cloud.iap.v1.IIdentityAwareProxyClient>): void; + listIdentityAwareProxyClients( + request: protos.google.cloud.iap.v1.IListIdentityAwareProxyClientsRequest, + callback: PaginationCallback< + protos.google.cloud.iap.v1.IListIdentityAwareProxyClientsRequest, + protos.google.cloud.iap.v1.IListIdentityAwareProxyClientsResponse|null|undefined, + protos.google.cloud.iap.v1.IIdentityAwareProxyClient>): void; + listIdentityAwareProxyClients( + request?: protos.google.cloud.iap.v1.IListIdentityAwareProxyClientsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.iap.v1.IListIdentityAwareProxyClientsRequest, + protos.google.cloud.iap.v1.IListIdentityAwareProxyClientsResponse|null|undefined, + protos.google.cloud.iap.v1.IIdentityAwareProxyClient>, + callback?: PaginationCallback< + protos.google.cloud.iap.v1.IListIdentityAwareProxyClientsRequest, + protos.google.cloud.iap.v1.IListIdentityAwareProxyClientsResponse|null|undefined, + protos.google.cloud.iap.v1.IIdentityAwareProxyClient>): + Promise<[ + protos.google.cloud.iap.v1.IIdentityAwareProxyClient[], + protos.google.cloud.iap.v1.IListIdentityAwareProxyClientsRequest|null, + protos.google.cloud.iap.v1.IListIdentityAwareProxyClientsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listIdentityAwareProxyClients(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. Full brand path. + * In the following format: projects/{project_number/id}/brands/{brand}. + * @param {number} request.pageSize + * The maximum number of clients to return. The service may return fewer than + * this value. + * If unspecified, at most 100 clients will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListIdentityAwareProxyClients` + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListIdentityAwareProxyClients` must match the call that provided the page + * token. + * @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 [IdentityAwareProxyClient]{@link google.cloud.iap.v1.IdentityAwareProxyClient} 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 `listIdentityAwareProxyClientsAsync()` + * 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. + */ + listIdentityAwareProxyClientsStream( + request?: protos.google.cloud.iap.v1.IListIdentityAwareProxyClientsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listIdentityAwareProxyClients']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listIdentityAwareProxyClients.createStream( + this.innerApiCalls.listIdentityAwareProxyClients as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listIdentityAwareProxyClients`, 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. Full brand path. + * In the following format: projects/{project_number/id}/brands/{brand}. + * @param {number} request.pageSize + * The maximum number of clients to return. The service may return fewer than + * this value. + * If unspecified, at most 100 clients will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListIdentityAwareProxyClients` + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListIdentityAwareProxyClients` must match the call that provided the 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 + * [IdentityAwareProxyClient]{@link google.cloud.iap.v1.IdentityAwareProxyClient}. 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/identity_aware_proxy_o_auth_service.list_identity_aware_proxy_clients.js + * region_tag:iap_v1_generated_IdentityAwareProxyOAuthService_ListIdentityAwareProxyClients_async + */ + listIdentityAwareProxyClientsAsync( + request?: protos.google.cloud.iap.v1.IListIdentityAwareProxyClientsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listIdentityAwareProxyClients']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listIdentityAwareProxyClients.asyncIterate( + this.innerApiCalls['listIdentityAwareProxyClients'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified tunnelDestGroup resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} dest_group + * @returns {string} Resource name string. + */ + tunnelDestGroupPath(project:string,location:string,destGroup:string) { + return this.pathTemplates.tunnelDestGroupPathTemplate.render({ + project: project, + location: location, + dest_group: destGroup, + }); + } + + /** + * Parse the project from TunnelDestGroup resource. + * + * @param {string} tunnelDestGroupName + * A fully-qualified path representing TunnelDestGroup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromTunnelDestGroupName(tunnelDestGroupName: string) { + return this.pathTemplates.tunnelDestGroupPathTemplate.match(tunnelDestGroupName).project; + } + + /** + * Parse the location from TunnelDestGroup resource. + * + * @param {string} tunnelDestGroupName + * A fully-qualified path representing TunnelDestGroup resource. + * @returns {string} A string representing the location. + */ + matchLocationFromTunnelDestGroupName(tunnelDestGroupName: string) { + return this.pathTemplates.tunnelDestGroupPathTemplate.match(tunnelDestGroupName).location; + } + + /** + * Parse the dest_group from TunnelDestGroup resource. + * + * @param {string} tunnelDestGroupName + * A fully-qualified path representing TunnelDestGroup resource. + * @returns {string} A string representing the dest_group. + */ + matchDestGroupFromTunnelDestGroupName(tunnelDestGroupName: string) { + return this.pathTemplates.tunnelDestGroupPathTemplate.match(tunnelDestGroupName).dest_group; + } + + /** + * Return a fully-qualified tunnelLocation resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + tunnelLocationPath(project:string,location:string) { + return this.pathTemplates.tunnelLocationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from TunnelLocation resource. + * + * @param {string} tunnelLocationName + * A fully-qualified path representing TunnelLocation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromTunnelLocationName(tunnelLocationName: string) { + return this.pathTemplates.tunnelLocationPathTemplate.match(tunnelLocationName).project; + } + + /** + * Parse the location from TunnelLocation resource. + * + * @param {string} tunnelLocationName + * A fully-qualified path representing TunnelLocation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromTunnelLocationName(tunnelLocationName: string) { + return this.pathTemplates.tunnelLocationPathTemplate.match(tunnelLocationName).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.identityAwareProxyOAuthServiceStub && !this._terminated) { + return this.identityAwareProxyOAuthServiceStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_o_auth_service_client_config.json b/owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_o_auth_service_client_config.json new file mode 100644 index 00000000000..03031e43136 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_o_auth_service_client_config.json @@ -0,0 +1,66 @@ +{ + "interfaces": { + "google.cloud.iap.v1.IdentityAwareProxyOAuthService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListBrands": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateBrand": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetBrand": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateIdentityAwareProxyClient": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListIdentityAwareProxyClients": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetIdentityAwareProxyClient": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ResetIdentityAwareProxyClientSecret": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteIdentityAwareProxyClient": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_o_auth_service_proto_list.json b/owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_o_auth_service_proto_list.json new file mode 100644 index 00000000000..54bf0f1d880 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_o_auth_service_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/cloud/iap/v1/service.proto" +] diff --git a/owl-bot-staging/google-cloud-iap/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-iap/v1/src/v1/index.ts new file mode 100644 index 00000000000..11b86574434 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1/src/v1/index.ts @@ -0,0 +1,20 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +export {IdentityAwareProxyAdminServiceClient} from './identity_aware_proxy_admin_service_client'; +export {IdentityAwareProxyOAuthServiceClient} from './identity_aware_proxy_o_auth_service_client'; diff --git a/owl-bot-staging/google-cloud-iap/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-iap/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..1a23a4844e2 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1/system-test/fixtures/sample/src/index.js @@ -0,0 +1,28 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 iap = require('@google-cloud/iap'); + +function main() { + const identityAwareProxyAdminServiceClient = new iap.IdentityAwareProxyAdminServiceClient(); + const identityAwareProxyOAuthServiceClient = new iap.IdentityAwareProxyOAuthServiceClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-iap/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-iap/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..b7a0f612aca --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,38 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 {IdentityAwareProxyAdminServiceClient, IdentityAwareProxyOAuthServiceClient} from '@google-cloud/iap'; + +// check that the client class type name can be used +function doStuffWithIdentityAwareProxyAdminServiceClient(client: IdentityAwareProxyAdminServiceClient) { + client.close(); +} +function doStuffWithIdentityAwareProxyOAuthServiceClient(client: IdentityAwareProxyOAuthServiceClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const identityAwareProxyAdminServiceClient = new IdentityAwareProxyAdminServiceClient(); + doStuffWithIdentityAwareProxyAdminServiceClient(identityAwareProxyAdminServiceClient); + // check that the client instance can be created + const identityAwareProxyOAuthServiceClient = new IdentityAwareProxyOAuthServiceClient(); + doStuffWithIdentityAwareProxyOAuthServiceClient(identityAwareProxyOAuthServiceClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-iap/v1/system-test/install.ts b/owl-bot-staging/google-cloud-iap/v1/system-test/install.ts new file mode 100644 index 00000000000..557a57558e1 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/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/google-cloud-iap/v1/test/gapic_identity_aware_proxy_admin_service_v1.ts b/owl-bot-staging/google-cloud-iap/v1/test/gapic_identity_aware_proxy_admin_service_v1.ts new file mode 100644 index 00000000000..c3cb7908ccd --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1/test/gapic_identity_aware_proxy_admin_service_v1.ts @@ -0,0 +1,1539 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 identityawareproxyadminserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.IdentityAwareProxyAdminServiceClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.identityAwareProxyAdminServiceStub, undefined); + await client.initialize(); + assert(client.identityAwareProxyAdminServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.identityAwareProxyAdminServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.identityAwareProxyAdminServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ + 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 identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ + 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('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.SetIamPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.SetIamPolicyRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v1.Policy() + ); + client.innerApiCalls.setIamPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.setIamPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setIamPolicy without error using callback', async () => { + const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.SetIamPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.SetIamPolicyRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v1.Policy() + ); + client.innerApiCalls.setIamPolicy = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setIamPolicy with error', async () => { + const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.SetIamPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.SetIamPolicyRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setIamPolicy(request), expectedError); + const actualRequest = (client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setIamPolicy with closed client', async () => { + const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.SetIamPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.SetIamPolicyRequest', ['resource']); + request.resource = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setIamPolicy(request), expectedError); + }); + }); + + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.GetIamPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v1.Policy() + ); + client.innerApiCalls.getIamPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.getIamPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getIamPolicy without error using callback', async () => { + const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.GetIamPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v1.Policy() + ); + client.innerApiCalls.getIamPolicy = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getIamPolicy with error', async () => { + const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.GetIamPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIamPolicy(request), expectedError); + const actualRequest = (client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getIamPolicy with closed client', async () => { + const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.GetIamPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); + request.resource = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getIamPolicy(request), expectedError); + }); + }); + + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.TestIamPermissionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.TestIamPermissionsRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v1.TestIamPermissionsResponse() + ); + client.innerApiCalls.testIamPermissions = stubSimpleCall(expectedResponse); + const [response] = await client.testIamPermissions(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes testIamPermissions without error using callback', async () => { + const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.TestIamPermissionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.TestIamPermissionsRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v1.TestIamPermissionsResponse() + ); + client.innerApiCalls.testIamPermissions = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + (err?: Error|null, result?: protos.google.iam.v1.ITestIamPermissionsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes testIamPermissions with error', async () => { + const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.TestIamPermissionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.TestIamPermissionsRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.testIamPermissions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.testIamPermissions(request), expectedError); + const actualRequest = (client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes testIamPermissions with closed client', async () => { + const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.TestIamPermissionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.TestIamPermissionsRequest', ['resource']); + request.resource = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.testIamPermissions(request), expectedError); + }); + }); + + describe('getIapSettings', () => { + it('invokes getIapSettings without error', async () => { + const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.GetIapSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.GetIapSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.iap.v1.IapSettings() + ); + client.innerApiCalls.getIapSettings = stubSimpleCall(expectedResponse); + const [response] = await client.getIapSettings(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getIapSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getIapSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getIapSettings without error using callback', async () => { + const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.GetIapSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.GetIapSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.iap.v1.IapSettings() + ); + client.innerApiCalls.getIapSettings = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIapSettings( + request, + (err?: Error|null, result?: protos.google.cloud.iap.v1.IIapSettings|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getIapSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getIapSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getIapSettings with error', async () => { + const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.GetIapSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.GetIapSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getIapSettings = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIapSettings(request), expectedError); + const actualRequest = (client.innerApiCalls.getIapSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getIapSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getIapSettings with closed client', async () => { + const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.GetIapSettingsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.GetIapSettingsRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getIapSettings(request), expectedError); + }); + }); + + describe('updateIapSettings', () => { + it('invokes updateIapSettings without error', async () => { + const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.UpdateIapSettingsRequest() + ); + request.iapSettings ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.UpdateIapSettingsRequest', ['iapSettings', 'name']); + request.iapSettings.name = defaultValue1; + const expectedHeaderRequestParams = `iap_settings.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.iap.v1.IapSettings() + ); + client.innerApiCalls.updateIapSettings = stubSimpleCall(expectedResponse); + const [response] = await client.updateIapSettings(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateIapSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateIapSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateIapSettings without error using callback', async () => { + const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.UpdateIapSettingsRequest() + ); + request.iapSettings ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.UpdateIapSettingsRequest', ['iapSettings', 'name']); + request.iapSettings.name = defaultValue1; + const expectedHeaderRequestParams = `iap_settings.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.iap.v1.IapSettings() + ); + client.innerApiCalls.updateIapSettings = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateIapSettings( + request, + (err?: Error|null, result?: protos.google.cloud.iap.v1.IIapSettings|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateIapSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateIapSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateIapSettings with error', async () => { + const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.UpdateIapSettingsRequest() + ); + request.iapSettings ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.UpdateIapSettingsRequest', ['iapSettings', 'name']); + request.iapSettings.name = defaultValue1; + const expectedHeaderRequestParams = `iap_settings.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateIapSettings = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateIapSettings(request), expectedError); + const actualRequest = (client.innerApiCalls.updateIapSettings as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateIapSettings as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateIapSettings with closed client', async () => { + const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.UpdateIapSettingsRequest() + ); + request.iapSettings ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.UpdateIapSettingsRequest', ['iapSettings', 'name']); + request.iapSettings.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateIapSettings(request), expectedError); + }); + }); + + describe('createTunnelDestGroup', () => { + it('invokes createTunnelDestGroup without error', async () => { + const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.CreateTunnelDestGroupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.CreateTunnelDestGroupRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.iap.v1.TunnelDestGroup() + ); + client.innerApiCalls.createTunnelDestGroup = stubSimpleCall(expectedResponse); + const [response] = await client.createTunnelDestGroup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createTunnelDestGroup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createTunnelDestGroup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createTunnelDestGroup without error using callback', async () => { + const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.CreateTunnelDestGroupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.CreateTunnelDestGroupRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.iap.v1.TunnelDestGroup() + ); + client.innerApiCalls.createTunnelDestGroup = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createTunnelDestGroup( + request, + (err?: Error|null, result?: protos.google.cloud.iap.v1.ITunnelDestGroup|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createTunnelDestGroup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createTunnelDestGroup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createTunnelDestGroup with error', async () => { + const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.CreateTunnelDestGroupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.CreateTunnelDestGroupRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createTunnelDestGroup = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createTunnelDestGroup(request), expectedError); + const actualRequest = (client.innerApiCalls.createTunnelDestGroup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createTunnelDestGroup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createTunnelDestGroup with closed client', async () => { + const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.CreateTunnelDestGroupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.CreateTunnelDestGroupRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createTunnelDestGroup(request), expectedError); + }); + }); + + describe('getTunnelDestGroup', () => { + it('invokes getTunnelDestGroup without error', async () => { + const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.GetTunnelDestGroupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.GetTunnelDestGroupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.iap.v1.TunnelDestGroup() + ); + client.innerApiCalls.getTunnelDestGroup = stubSimpleCall(expectedResponse); + const [response] = await client.getTunnelDestGroup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getTunnelDestGroup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getTunnelDestGroup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getTunnelDestGroup without error using callback', async () => { + const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.GetTunnelDestGroupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.GetTunnelDestGroupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.iap.v1.TunnelDestGroup() + ); + client.innerApiCalls.getTunnelDestGroup = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getTunnelDestGroup( + request, + (err?: Error|null, result?: protos.google.cloud.iap.v1.ITunnelDestGroup|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getTunnelDestGroup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getTunnelDestGroup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getTunnelDestGroup with error', async () => { + const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.GetTunnelDestGroupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.GetTunnelDestGroupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getTunnelDestGroup = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getTunnelDestGroup(request), expectedError); + const actualRequest = (client.innerApiCalls.getTunnelDestGroup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getTunnelDestGroup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getTunnelDestGroup with closed client', async () => { + const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.GetTunnelDestGroupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.GetTunnelDestGroupRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getTunnelDestGroup(request), expectedError); + }); + }); + + describe('deleteTunnelDestGroup', () => { + it('invokes deleteTunnelDestGroup without error', async () => { + const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.DeleteTunnelDestGroupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.DeleteTunnelDestGroupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteTunnelDestGroup = stubSimpleCall(expectedResponse); + const [response] = await client.deleteTunnelDestGroup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteTunnelDestGroup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteTunnelDestGroup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteTunnelDestGroup without error using callback', async () => { + const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.DeleteTunnelDestGroupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.DeleteTunnelDestGroupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteTunnelDestGroup = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteTunnelDestGroup( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteTunnelDestGroup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteTunnelDestGroup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteTunnelDestGroup with error', async () => { + const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.DeleteTunnelDestGroupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.DeleteTunnelDestGroupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteTunnelDestGroup = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteTunnelDestGroup(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteTunnelDestGroup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteTunnelDestGroup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteTunnelDestGroup with closed client', async () => { + const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.DeleteTunnelDestGroupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.DeleteTunnelDestGroupRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteTunnelDestGroup(request), expectedError); + }); + }); + + describe('updateTunnelDestGroup', () => { + it('invokes updateTunnelDestGroup without error', async () => { + const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.UpdateTunnelDestGroupRequest() + ); + request.tunnelDestGroup ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.UpdateTunnelDestGroupRequest', ['tunnelDestGroup', 'name']); + request.tunnelDestGroup.name = defaultValue1; + const expectedHeaderRequestParams = `tunnel_dest_group.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.iap.v1.TunnelDestGroup() + ); + client.innerApiCalls.updateTunnelDestGroup = stubSimpleCall(expectedResponse); + const [response] = await client.updateTunnelDestGroup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateTunnelDestGroup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateTunnelDestGroup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateTunnelDestGroup without error using callback', async () => { + const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.UpdateTunnelDestGroupRequest() + ); + request.tunnelDestGroup ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.UpdateTunnelDestGroupRequest', ['tunnelDestGroup', 'name']); + request.tunnelDestGroup.name = defaultValue1; + const expectedHeaderRequestParams = `tunnel_dest_group.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.iap.v1.TunnelDestGroup() + ); + client.innerApiCalls.updateTunnelDestGroup = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateTunnelDestGroup( + request, + (err?: Error|null, result?: protos.google.cloud.iap.v1.ITunnelDestGroup|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateTunnelDestGroup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateTunnelDestGroup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateTunnelDestGroup with error', async () => { + const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.UpdateTunnelDestGroupRequest() + ); + request.tunnelDestGroup ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.UpdateTunnelDestGroupRequest', ['tunnelDestGroup', 'name']); + request.tunnelDestGroup.name = defaultValue1; + const expectedHeaderRequestParams = `tunnel_dest_group.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateTunnelDestGroup = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateTunnelDestGroup(request), expectedError); + const actualRequest = (client.innerApiCalls.updateTunnelDestGroup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateTunnelDestGroup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateTunnelDestGroup with closed client', async () => { + const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.UpdateTunnelDestGroupRequest() + ); + request.tunnelDestGroup ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.UpdateTunnelDestGroupRequest', ['tunnelDestGroup', 'name']); + request.tunnelDestGroup.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateTunnelDestGroup(request), expectedError); + }); + }); + + describe('listTunnelDestGroups', () => { + it('invokes listTunnelDestGroups without error', async () => { + const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.ListTunnelDestGroupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.ListTunnelDestGroupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.iap.v1.TunnelDestGroup()), + generateSampleMessage(new protos.google.cloud.iap.v1.TunnelDestGroup()), + generateSampleMessage(new protos.google.cloud.iap.v1.TunnelDestGroup()), + ]; + client.innerApiCalls.listTunnelDestGroups = stubSimpleCall(expectedResponse); + const [response] = await client.listTunnelDestGroups(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listTunnelDestGroups as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listTunnelDestGroups as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listTunnelDestGroups without error using callback', async () => { + const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.ListTunnelDestGroupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.ListTunnelDestGroupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.iap.v1.TunnelDestGroup()), + generateSampleMessage(new protos.google.cloud.iap.v1.TunnelDestGroup()), + generateSampleMessage(new protos.google.cloud.iap.v1.TunnelDestGroup()), + ]; + client.innerApiCalls.listTunnelDestGroups = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listTunnelDestGroups( + request, + (err?: Error|null, result?: protos.google.cloud.iap.v1.ITunnelDestGroup[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listTunnelDestGroups as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listTunnelDestGroups as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listTunnelDestGroups with error', async () => { + const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.ListTunnelDestGroupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.ListTunnelDestGroupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listTunnelDestGroups = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listTunnelDestGroups(request), expectedError); + const actualRequest = (client.innerApiCalls.listTunnelDestGroups as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listTunnelDestGroups as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listTunnelDestGroupsStream without error', async () => { + const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.ListTunnelDestGroupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.ListTunnelDestGroupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.iap.v1.TunnelDestGroup()), + generateSampleMessage(new protos.google.cloud.iap.v1.TunnelDestGroup()), + generateSampleMessage(new protos.google.cloud.iap.v1.TunnelDestGroup()), + ]; + client.descriptors.page.listTunnelDestGroups.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listTunnelDestGroupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.iap.v1.TunnelDestGroup[] = []; + stream.on('data', (response: protos.google.cloud.iap.v1.TunnelDestGroup) => { + 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.listTunnelDestGroups.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listTunnelDestGroups, request)); + assert( + (client.descriptors.page.listTunnelDestGroups.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listTunnelDestGroupsStream with error', async () => { + const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.ListTunnelDestGroupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.ListTunnelDestGroupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listTunnelDestGroups.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listTunnelDestGroupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.iap.v1.TunnelDestGroup[] = []; + stream.on('data', (response: protos.google.cloud.iap.v1.TunnelDestGroup) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listTunnelDestGroups.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listTunnelDestGroups, request)); + assert( + (client.descriptors.page.listTunnelDestGroups.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listTunnelDestGroups without error', async () => { + const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.ListTunnelDestGroupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.ListTunnelDestGroupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.iap.v1.TunnelDestGroup()), + generateSampleMessage(new protos.google.cloud.iap.v1.TunnelDestGroup()), + generateSampleMessage(new protos.google.cloud.iap.v1.TunnelDestGroup()), + ]; + client.descriptors.page.listTunnelDestGroups.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.iap.v1.ITunnelDestGroup[] = []; + const iterable = client.listTunnelDestGroupsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listTunnelDestGroups.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listTunnelDestGroups.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listTunnelDestGroups with error', async () => { + const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.ListTunnelDestGroupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.ListTunnelDestGroupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listTunnelDestGroups.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listTunnelDestGroupsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.iap.v1.ITunnelDestGroup[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listTunnelDestGroups.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listTunnelDestGroups.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('tunnelDestGroup', () => { + const fakePath = "/rendered/path/tunnelDestGroup"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + dest_group: "destGroupValue", + }; + const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.tunnelDestGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.tunnelDestGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('tunnelDestGroupPath', () => { + const result = client.tunnelDestGroupPath("projectValue", "locationValue", "destGroupValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.tunnelDestGroupPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromTunnelDestGroupName', () => { + const result = client.matchProjectFromTunnelDestGroupName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.tunnelDestGroupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromTunnelDestGroupName', () => { + const result = client.matchLocationFromTunnelDestGroupName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.tunnelDestGroupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchDestGroupFromTunnelDestGroupName', () => { + const result = client.matchDestGroupFromTunnelDestGroupName(fakePath); + assert.strictEqual(result, "destGroupValue"); + assert((client.pathTemplates.tunnelDestGroupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('tunnelLocation', () => { + const fakePath = "/rendered/path/tunnelLocation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.tunnelLocationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.tunnelLocationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('tunnelLocationPath', () => { + const result = client.tunnelLocationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.tunnelLocationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromTunnelLocationName', () => { + const result = client.matchProjectFromTunnelLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.tunnelLocationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromTunnelLocationName', () => { + const result = client.matchLocationFromTunnelLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.tunnelLocationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-iap/v1/test/gapic_identity_aware_proxy_o_auth_service_v1.ts b/owl-bot-staging/google-cloud-iap/v1/test/gapic_identity_aware_proxy_o_auth_service_v1.ts new file mode 100644 index 00000000000..c292536e2d5 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1/test/gapic_identity_aware_proxy_o_auth_service_v1.ts @@ -0,0 +1,1315 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 identityawareproxyoauthserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.IdentityAwareProxyOAuthServiceClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.identityAwareProxyOAuthServiceStub, undefined); + await client.initialize(); + assert(client.identityAwareProxyOAuthServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.identityAwareProxyOAuthServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.identityAwareProxyOAuthServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ + 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 identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ + 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('listBrands', () => { + it('invokes listBrands without error', async () => { + const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.ListBrandsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.ListBrandsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.iap.v1.ListBrandsResponse() + ); + client.innerApiCalls.listBrands = stubSimpleCall(expectedResponse); + const [response] = await client.listBrands(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listBrands as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listBrands as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBrands without error using callback', async () => { + const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.ListBrandsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.ListBrandsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.iap.v1.ListBrandsResponse() + ); + client.innerApiCalls.listBrands = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listBrands( + request, + (err?: Error|null, result?: protos.google.cloud.iap.v1.IListBrandsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listBrands as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listBrands as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBrands with error', async () => { + const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.ListBrandsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.ListBrandsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listBrands = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listBrands(request), expectedError); + const actualRequest = (client.innerApiCalls.listBrands as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listBrands as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBrands with closed client', async () => { + const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.ListBrandsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.ListBrandsRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.listBrands(request), expectedError); + }); + }); + + describe('createBrand', () => { + it('invokes createBrand without error', async () => { + const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.CreateBrandRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.CreateBrandRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.iap.v1.Brand() + ); + client.innerApiCalls.createBrand = stubSimpleCall(expectedResponse); + const [response] = await client.createBrand(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createBrand as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBrand as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBrand without error using callback', async () => { + const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.CreateBrandRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.CreateBrandRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.iap.v1.Brand() + ); + client.innerApiCalls.createBrand = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createBrand( + request, + (err?: Error|null, result?: protos.google.cloud.iap.v1.IBrand|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createBrand as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBrand as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBrand with error', async () => { + const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.CreateBrandRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.CreateBrandRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createBrand = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createBrand(request), expectedError); + const actualRequest = (client.innerApiCalls.createBrand as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBrand as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBrand with closed client', async () => { + const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.CreateBrandRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.CreateBrandRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createBrand(request), expectedError); + }); + }); + + describe('getBrand', () => { + it('invokes getBrand without error', async () => { + const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.GetBrandRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.GetBrandRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.iap.v1.Brand() + ); + client.innerApiCalls.getBrand = stubSimpleCall(expectedResponse); + const [response] = await client.getBrand(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getBrand as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBrand as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBrand without error using callback', async () => { + const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.GetBrandRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.GetBrandRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.iap.v1.Brand() + ); + client.innerApiCalls.getBrand = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getBrand( + request, + (err?: Error|null, result?: protos.google.cloud.iap.v1.IBrand|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getBrand as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBrand as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBrand with error', async () => { + const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.GetBrandRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.GetBrandRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getBrand = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getBrand(request), expectedError); + const actualRequest = (client.innerApiCalls.getBrand as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBrand as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBrand with closed client', async () => { + const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.GetBrandRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.GetBrandRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getBrand(request), expectedError); + }); + }); + + describe('createIdentityAwareProxyClient', () => { + it('invokes createIdentityAwareProxyClient without error', async () => { + const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.CreateIdentityAwareProxyClientRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.CreateIdentityAwareProxyClientRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.iap.v1.IdentityAwareProxyClient() + ); + client.innerApiCalls.createIdentityAwareProxyClient = stubSimpleCall(expectedResponse); + const [response] = await client.createIdentityAwareProxyClient(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createIdentityAwareProxyClient as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createIdentityAwareProxyClient as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createIdentityAwareProxyClient without error using callback', async () => { + const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.CreateIdentityAwareProxyClientRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.CreateIdentityAwareProxyClientRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.iap.v1.IdentityAwareProxyClient() + ); + client.innerApiCalls.createIdentityAwareProxyClient = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createIdentityAwareProxyClient( + request, + (err?: Error|null, result?: protos.google.cloud.iap.v1.IIdentityAwareProxyClient|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createIdentityAwareProxyClient as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createIdentityAwareProxyClient as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createIdentityAwareProxyClient with error', async () => { + const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.CreateIdentityAwareProxyClientRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.CreateIdentityAwareProxyClientRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createIdentityAwareProxyClient = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createIdentityAwareProxyClient(request), expectedError); + const actualRequest = (client.innerApiCalls.createIdentityAwareProxyClient as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createIdentityAwareProxyClient as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createIdentityAwareProxyClient with closed client', async () => { + const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.CreateIdentityAwareProxyClientRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.CreateIdentityAwareProxyClientRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createIdentityAwareProxyClient(request), expectedError); + }); + }); + + describe('getIdentityAwareProxyClient', () => { + it('invokes getIdentityAwareProxyClient without error', async () => { + const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.GetIdentityAwareProxyClientRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.GetIdentityAwareProxyClientRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.iap.v1.IdentityAwareProxyClient() + ); + client.innerApiCalls.getIdentityAwareProxyClient = stubSimpleCall(expectedResponse); + const [response] = await client.getIdentityAwareProxyClient(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getIdentityAwareProxyClient as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getIdentityAwareProxyClient as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getIdentityAwareProxyClient without error using callback', async () => { + const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.GetIdentityAwareProxyClientRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.GetIdentityAwareProxyClientRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.iap.v1.IdentityAwareProxyClient() + ); + client.innerApiCalls.getIdentityAwareProxyClient = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIdentityAwareProxyClient( + request, + (err?: Error|null, result?: protos.google.cloud.iap.v1.IIdentityAwareProxyClient|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getIdentityAwareProxyClient as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getIdentityAwareProxyClient as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getIdentityAwareProxyClient with error', async () => { + const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.GetIdentityAwareProxyClientRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.GetIdentityAwareProxyClientRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getIdentityAwareProxyClient = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIdentityAwareProxyClient(request), expectedError); + const actualRequest = (client.innerApiCalls.getIdentityAwareProxyClient as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getIdentityAwareProxyClient as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getIdentityAwareProxyClient with closed client', async () => { + const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.GetIdentityAwareProxyClientRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.GetIdentityAwareProxyClientRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getIdentityAwareProxyClient(request), expectedError); + }); + }); + + describe('resetIdentityAwareProxyClientSecret', () => { + it('invokes resetIdentityAwareProxyClientSecret without error', async () => { + const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.ResetIdentityAwareProxyClientSecretRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.ResetIdentityAwareProxyClientSecretRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.iap.v1.IdentityAwareProxyClient() + ); + client.innerApiCalls.resetIdentityAwareProxyClientSecret = stubSimpleCall(expectedResponse); + const [response] = await client.resetIdentityAwareProxyClientSecret(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.resetIdentityAwareProxyClientSecret as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.resetIdentityAwareProxyClientSecret as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes resetIdentityAwareProxyClientSecret without error using callback', async () => { + const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.ResetIdentityAwareProxyClientSecretRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.ResetIdentityAwareProxyClientSecretRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.iap.v1.IdentityAwareProxyClient() + ); + client.innerApiCalls.resetIdentityAwareProxyClientSecret = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.resetIdentityAwareProxyClientSecret( + request, + (err?: Error|null, result?: protos.google.cloud.iap.v1.IIdentityAwareProxyClient|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.resetIdentityAwareProxyClientSecret as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.resetIdentityAwareProxyClientSecret as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes resetIdentityAwareProxyClientSecret with error', async () => { + const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.ResetIdentityAwareProxyClientSecretRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.ResetIdentityAwareProxyClientSecretRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.resetIdentityAwareProxyClientSecret = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.resetIdentityAwareProxyClientSecret(request), expectedError); + const actualRequest = (client.innerApiCalls.resetIdentityAwareProxyClientSecret as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.resetIdentityAwareProxyClientSecret as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes resetIdentityAwareProxyClientSecret with closed client', async () => { + const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.ResetIdentityAwareProxyClientSecretRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.ResetIdentityAwareProxyClientSecretRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.resetIdentityAwareProxyClientSecret(request), expectedError); + }); + }); + + describe('deleteIdentityAwareProxyClient', () => { + it('invokes deleteIdentityAwareProxyClient without error', async () => { + const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.DeleteIdentityAwareProxyClientRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.DeleteIdentityAwareProxyClientRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteIdentityAwareProxyClient = stubSimpleCall(expectedResponse); + const [response] = await client.deleteIdentityAwareProxyClient(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteIdentityAwareProxyClient as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteIdentityAwareProxyClient as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteIdentityAwareProxyClient without error using callback', async () => { + const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.DeleteIdentityAwareProxyClientRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.DeleteIdentityAwareProxyClientRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteIdentityAwareProxyClient = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteIdentityAwareProxyClient( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteIdentityAwareProxyClient as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteIdentityAwareProxyClient as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteIdentityAwareProxyClient with error', async () => { + const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.DeleteIdentityAwareProxyClientRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.DeleteIdentityAwareProxyClientRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteIdentityAwareProxyClient = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteIdentityAwareProxyClient(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteIdentityAwareProxyClient as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteIdentityAwareProxyClient as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteIdentityAwareProxyClient with closed client', async () => { + const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.DeleteIdentityAwareProxyClientRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.DeleteIdentityAwareProxyClientRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteIdentityAwareProxyClient(request), expectedError); + }); + }); + + describe('listIdentityAwareProxyClients', () => { + it('invokes listIdentityAwareProxyClients without error', async () => { + const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.ListIdentityAwareProxyClientsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.ListIdentityAwareProxyClientsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.iap.v1.IdentityAwareProxyClient()), + generateSampleMessage(new protos.google.cloud.iap.v1.IdentityAwareProxyClient()), + generateSampleMessage(new protos.google.cloud.iap.v1.IdentityAwareProxyClient()), + ]; + client.innerApiCalls.listIdentityAwareProxyClients = stubSimpleCall(expectedResponse); + const [response] = await client.listIdentityAwareProxyClients(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listIdentityAwareProxyClients as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listIdentityAwareProxyClients as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listIdentityAwareProxyClients without error using callback', async () => { + const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.ListIdentityAwareProxyClientsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.ListIdentityAwareProxyClientsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.iap.v1.IdentityAwareProxyClient()), + generateSampleMessage(new protos.google.cloud.iap.v1.IdentityAwareProxyClient()), + generateSampleMessage(new protos.google.cloud.iap.v1.IdentityAwareProxyClient()), + ]; + client.innerApiCalls.listIdentityAwareProxyClients = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listIdentityAwareProxyClients( + request, + (err?: Error|null, result?: protos.google.cloud.iap.v1.IIdentityAwareProxyClient[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listIdentityAwareProxyClients as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listIdentityAwareProxyClients as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listIdentityAwareProxyClients with error', async () => { + const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.ListIdentityAwareProxyClientsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.ListIdentityAwareProxyClientsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listIdentityAwareProxyClients = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listIdentityAwareProxyClients(request), expectedError); + const actualRequest = (client.innerApiCalls.listIdentityAwareProxyClients as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listIdentityAwareProxyClients as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listIdentityAwareProxyClientsStream without error', async () => { + const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.ListIdentityAwareProxyClientsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.ListIdentityAwareProxyClientsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.iap.v1.IdentityAwareProxyClient()), + generateSampleMessage(new protos.google.cloud.iap.v1.IdentityAwareProxyClient()), + generateSampleMessage(new protos.google.cloud.iap.v1.IdentityAwareProxyClient()), + ]; + client.descriptors.page.listIdentityAwareProxyClients.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listIdentityAwareProxyClientsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.iap.v1.IdentityAwareProxyClient[] = []; + stream.on('data', (response: protos.google.cloud.iap.v1.IdentityAwareProxyClient) => { + 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.listIdentityAwareProxyClients.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listIdentityAwareProxyClients, request)); + assert( + (client.descriptors.page.listIdentityAwareProxyClients.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listIdentityAwareProxyClientsStream with error', async () => { + const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.ListIdentityAwareProxyClientsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.ListIdentityAwareProxyClientsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listIdentityAwareProxyClients.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listIdentityAwareProxyClientsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.iap.v1.IdentityAwareProxyClient[] = []; + stream.on('data', (response: protos.google.cloud.iap.v1.IdentityAwareProxyClient) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listIdentityAwareProxyClients.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listIdentityAwareProxyClients, request)); + assert( + (client.descriptors.page.listIdentityAwareProxyClients.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listIdentityAwareProxyClients without error', async () => { + const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.ListIdentityAwareProxyClientsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.ListIdentityAwareProxyClientsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.iap.v1.IdentityAwareProxyClient()), + generateSampleMessage(new protos.google.cloud.iap.v1.IdentityAwareProxyClient()), + generateSampleMessage(new protos.google.cloud.iap.v1.IdentityAwareProxyClient()), + ]; + client.descriptors.page.listIdentityAwareProxyClients.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.iap.v1.IIdentityAwareProxyClient[] = []; + const iterable = client.listIdentityAwareProxyClientsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listIdentityAwareProxyClients.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listIdentityAwareProxyClients.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listIdentityAwareProxyClients with error', async () => { + const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.iap.v1.ListIdentityAwareProxyClientsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.iap.v1.ListIdentityAwareProxyClientsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listIdentityAwareProxyClients.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listIdentityAwareProxyClientsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.iap.v1.IIdentityAwareProxyClient[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listIdentityAwareProxyClients.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listIdentityAwareProxyClients.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('tunnelDestGroup', () => { + const fakePath = "/rendered/path/tunnelDestGroup"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + dest_group: "destGroupValue", + }; + const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.tunnelDestGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.tunnelDestGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('tunnelDestGroupPath', () => { + const result = client.tunnelDestGroupPath("projectValue", "locationValue", "destGroupValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.tunnelDestGroupPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromTunnelDestGroupName', () => { + const result = client.matchProjectFromTunnelDestGroupName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.tunnelDestGroupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromTunnelDestGroupName', () => { + const result = client.matchLocationFromTunnelDestGroupName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.tunnelDestGroupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchDestGroupFromTunnelDestGroupName', () => { + const result = client.matchDestGroupFromTunnelDestGroupName(fakePath); + assert.strictEqual(result, "destGroupValue"); + assert((client.pathTemplates.tunnelDestGroupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('tunnelLocation', () => { + const fakePath = "/rendered/path/tunnelLocation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.tunnelLocationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.tunnelLocationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('tunnelLocationPath', () => { + const result = client.tunnelLocationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.tunnelLocationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromTunnelLocationName', () => { + const result = client.matchProjectFromTunnelLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.tunnelLocationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromTunnelLocationName', () => { + const result = client.matchLocationFromTunnelLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.tunnelLocationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-iap/v1/tsconfig.json b/owl-bot-staging/google-cloud-iap/v1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/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/google-cloud-iap/v1/webpack.config.js b/owl-bot-staging/google-cloud-iap/v1/webpack.config.js new file mode 100644 index 00000000000..8b5bcd41c97 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/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: 'IdentityAwareProxyAdminService', + filename: './identity-aware-proxy-admin-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/google-cloud-iap/v1beta1/.eslintignore b/owl-bot-staging/google-cloud-iap/v1beta1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1beta1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-iap/v1beta1/.eslintrc.json b/owl-bot-staging/google-cloud-iap/v1beta1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1beta1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-iap/v1beta1/.gitignore b/owl-bot-staging/google-cloud-iap/v1beta1/.gitignore new file mode 100644 index 00000000000..5d32b23782f --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/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/google-cloud-iap/v1beta1/.jsdoc.js b/owl-bot-staging/google-cloud-iap/v1beta1/.jsdoc.js new file mode 100644 index 00000000000..c516e1ec527 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/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/iap', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-iap/v1beta1/.mocharc.js b/owl-bot-staging/google-cloud-iap/v1beta1/.mocharc.js new file mode 100644 index 00000000000..481c522b00f --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/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/google-cloud-iap/v1beta1/.prettierrc.js b/owl-bot-staging/google-cloud-iap/v1beta1/.prettierrc.js new file mode 100644 index 00000000000..494e147865d --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/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/google-cloud-iap/v1beta1/README.md b/owl-bot-staging/google-cloud-iap/v1beta1/README.md new file mode 100644 index 00000000000..1ede6beeb65 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1beta1/README.md @@ -0,0 +1 @@ +Iap: Nodejs Client diff --git a/owl-bot-staging/google-cloud-iap/v1beta1/linkinator.config.json b/owl-bot-staging/google-cloud-iap/v1beta1/linkinator.config.json new file mode 100644 index 00000000000..befd23c8633 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/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/google-cloud-iap/v1beta1/package.json b/owl-bot-staging/google-cloud-iap/v1beta1/package.json new file mode 100644 index 00000000000..37f8296bc21 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1beta1/package.json @@ -0,0 +1,64 @@ +{ + "name": "@google-cloud/iap", + "version": "0.1.0", + "description": "Iap client for Node.js", + "repository": "googleapis/nodejs-iap", + "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 iap", + "iap", + "identity aware proxy admin v1 beta1" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "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.5.2" + }, + "devDependencies": { + "@types/mocha": "^9.1.1", + "@types/node": "^16.11.62", + "@types/sinon": "^10.0.13", + "c8": "^7.12.0", + "gts": "^3.1.1", + "jsdoc": "^3.6.11", + "jsdoc-fresh": "^2.0.1", + "jsdoc-region-tag": "^2.0.1", + "linkinator": "^4.0.3", + "mocha": "^10.0.0", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^14.0.0", + "ts-loader": "^8.4.0", + "typescript": "^4.8.3", + "webpack": "^4.46.0", + "webpack-cli": "^4.10.0" + }, + "engines": { + "node": ">=v12" + } +} diff --git a/owl-bot-staging/google-cloud-iap/v1beta1/protos/google/cloud/iap/v1beta1/service.proto b/owl-bot-staging/google-cloud-iap/v1beta1/protos/google/cloud/iap/v1beta1/service.proto new file mode 100644 index 00000000000..a414a339be9 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1beta1/protos/google/cloud/iap/v1beta1/service.proto @@ -0,0 +1,71 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.iap.v1beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/iam/v1/iam_policy.proto"; +import "google/iam/v1/policy.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/iap/v1beta1;iap"; +option java_multiple_files = true; +option java_package = "com.google.cloud.iap.v1beta1"; + +// APIs for Identity-Aware Proxy Admin configurations. +service IdentityAwareProxyAdminV1Beta1 { + option (google.api.default_host) = "iap.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Sets the access control policy for an Identity-Aware Proxy protected + // resource. Replaces any existing policy. + // More information about managing access via IAP can be found at: + // https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api + rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) + returns (google.iam.v1.Policy) { + option (google.api.http) = { + post: "/v1beta1/{resource=**}:setIamPolicy" + body: "*" + }; + } + + // Gets the access control policy for an Identity-Aware Proxy protected + // resource. + // More information about managing access via IAP can be found at: + // https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api + rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) + returns (google.iam.v1.Policy) { + option (google.api.http) = { + post: "/v1beta1/{resource=**}:getIamPolicy" + body: "*" + }; + } + + // Returns permissions that a caller has on the Identity-Aware Proxy protected + // resource. If the resource does not exist or the caller does not have + // Identity-Aware Proxy permissions a [google.rpc.Code.PERMISSION_DENIED] + // will be returned. + // More information about managing access via IAP can be found at: + // https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api + rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) + returns (google.iam.v1.TestIamPermissionsResponse) { + option (google.api.http) = { + post: "/v1beta1/{resource=**}:testIamPermissions" + body: "*" + }; + } +} diff --git a/owl-bot-staging/google-cloud-iap/v1beta1/samples/generated/v1beta1/identity_aware_proxy_admin_v1_beta1.get_iam_policy.js b/owl-bot-staging/google-cloud-iap/v1beta1/samples/generated/v1beta1/identity_aware_proxy_admin_v1_beta1.get_iam_policy.js new file mode 100644 index 00000000000..5a419b76dd2 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1beta1/samples/generated/v1beta1/identity_aware_proxy_admin_v1_beta1.get_iam_policy.js @@ -0,0 +1,67 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(resource) { + // [START iap_v1beta1_generated_IdentityAwareProxyAdminV1Beta1_GetIamPolicy_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + */ + // const resource = 'abc123' + /** + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. + */ + // const options = {} + + // Imports the Iap library + const {IdentityAwareProxyAdminV1Beta1Client} = require('@google-cloud/iap').v1beta1; + + // Instantiates a client + const iapClient = new IdentityAwareProxyAdminV1Beta1Client(); + + async function callGetIamPolicy() { + // Construct request + const request = { + resource, + }; + + // Run request + const response = await iapClient.getIamPolicy(request); + console.log(response); + } + + callGetIamPolicy(); + // [END iap_v1beta1_generated_IdentityAwareProxyAdminV1Beta1_GetIamPolicy_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-iap/v1beta1/samples/generated/v1beta1/identity_aware_proxy_admin_v1_beta1.set_iam_policy.js b/owl-bot-staging/google-cloud-iap/v1beta1/samples/generated/v1beta1/identity_aware_proxy_admin_v1_beta1.set_iam_policy.js new file mode 100644 index 00000000000..d3c8a8fa50e --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1beta1/samples/generated/v1beta1/identity_aware_proxy_admin_v1_beta1.set_iam_policy.js @@ -0,0 +1,77 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(resource, policy) { + // [START iap_v1beta1_generated_IdentityAwareProxyAdminV1Beta1_SetIamPolicy_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * REQUIRED: The resource for which the policy is being specified. + * See the operation documentation for the appropriate value for this field. + */ + // const resource = 'abc123' + /** + * REQUIRED: The complete policy to be applied to the `resource`. The size of + * the policy is limited to a few 10s of KB. An empty policy is a + * valid policy but certain Cloud Platform services (such as Projects) + * might reject them. + */ + // const policy = {} + /** + * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only + * the fields in the mask will be modified. If no mask is provided, the + * following default mask is used: + * `paths: "bindings, etag"` + */ + // const updateMask = {} + + // Imports the Iap library + const {IdentityAwareProxyAdminV1Beta1Client} = require('@google-cloud/iap').v1beta1; + + // Instantiates a client + const iapClient = new IdentityAwareProxyAdminV1Beta1Client(); + + async function callSetIamPolicy() { + // Construct request + const request = { + resource, + policy, + }; + + // Run request + const response = await iapClient.setIamPolicy(request); + console.log(response); + } + + callSetIamPolicy(); + // [END iap_v1beta1_generated_IdentityAwareProxyAdminV1Beta1_SetIamPolicy_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-iap/v1beta1/samples/generated/v1beta1/identity_aware_proxy_admin_v1_beta1.test_iam_permissions.js b/owl-bot-staging/google-cloud-iap/v1beta1/samples/generated/v1beta1/identity_aware_proxy_admin_v1_beta1.test_iam_permissions.js new file mode 100644 index 00000000000..21952d2c42b --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1beta1/samples/generated/v1beta1/identity_aware_proxy_admin_v1_beta1.test_iam_permissions.js @@ -0,0 +1,70 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(resource, permissions) { + // [START iap_v1beta1_generated_IdentityAwareProxyAdminV1Beta1_TestIamPermissions_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + */ + // const resource = 'abc123' + /** + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * IAM Overview (https://cloud.google.com/iam/docs/overview#permissions). + */ + // const permissions = 'abc123' + + // Imports the Iap library + const {IdentityAwareProxyAdminV1Beta1Client} = require('@google-cloud/iap').v1beta1; + + // Instantiates a client + const iapClient = new IdentityAwareProxyAdminV1Beta1Client(); + + async function callTestIamPermissions() { + // Construct request + const request = { + resource, + permissions, + }; + + // Run request + const response = await iapClient.testIamPermissions(request); + console.log(response); + } + + callTestIamPermissions(); + // [END iap_v1beta1_generated_IdentityAwareProxyAdminV1Beta1_TestIamPermissions_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-iap/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.iap.v1beta1.json b/owl-bot-staging/google-cloud-iap/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.iap.v1beta1.json new file mode 100644 index 00000000000..a3dad319632 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.iap.v1beta1.json @@ -0,0 +1,151 @@ +{ + "clientLibrary": { + "name": "nodejs-iap", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.iap.v1beta1", + "version": "v1beta1" + } + ] + }, + "snippets": [ + { + "regionTag": "iap_v1beta1_generated_IdentityAwareProxyAdminV1Beta1_SetIamPolicy_async", + "title": "IdentityAwareProxyAdminV1Beta1 setIamPolicy Sample", + "origin": "API_DEFINITION", + "description": " Sets the access control policy for an Identity-Aware Proxy protected resource. Replaces any existing policy. More information about managing access via IAP can be found at: https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api", + "canonical": true, + "file": "identity_aware_proxy_admin_v1_beta1.set_iam_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetIamPolicy", + "fullName": "google.cloud.iap.v1beta1.IdentityAwareProxyAdminV1Beta1.SetIamPolicy", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "policy", + "type": ".google.iam.v1.Policy" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.iam.v1.Policy", + "client": { + "shortName": "IdentityAwareProxyAdminV1Beta1Client", + "fullName": "google.cloud.iap.v1beta1.IdentityAwareProxyAdminV1Beta1Client" + }, + "method": { + "shortName": "SetIamPolicy", + "fullName": "google.cloud.iap.v1beta1.IdentityAwareProxyAdminV1Beta1.SetIamPolicy", + "service": { + "shortName": "IdentityAwareProxyAdminV1Beta1", + "fullName": "google.cloud.iap.v1beta1.IdentityAwareProxyAdminV1Beta1" + } + } + } + }, + { + "regionTag": "iap_v1beta1_generated_IdentityAwareProxyAdminV1Beta1_GetIamPolicy_async", + "title": "IdentityAwareProxyAdminV1Beta1 getIamPolicy Sample", + "origin": "API_DEFINITION", + "description": " Gets the access control policy for an Identity-Aware Proxy protected resource. More information about managing access via IAP can be found at: https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api", + "canonical": true, + "file": "identity_aware_proxy_admin_v1_beta1.get_iam_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetIamPolicy", + "fullName": "google.cloud.iap.v1beta1.IdentityAwareProxyAdminV1Beta1.GetIamPolicy", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "options", + "type": ".google.iam.v1.GetPolicyOptions" + } + ], + "resultType": ".google.iam.v1.Policy", + "client": { + "shortName": "IdentityAwareProxyAdminV1Beta1Client", + "fullName": "google.cloud.iap.v1beta1.IdentityAwareProxyAdminV1Beta1Client" + }, + "method": { + "shortName": "GetIamPolicy", + "fullName": "google.cloud.iap.v1beta1.IdentityAwareProxyAdminV1Beta1.GetIamPolicy", + "service": { + "shortName": "IdentityAwareProxyAdminV1Beta1", + "fullName": "google.cloud.iap.v1beta1.IdentityAwareProxyAdminV1Beta1" + } + } + } + }, + { + "regionTag": "iap_v1beta1_generated_IdentityAwareProxyAdminV1Beta1_TestIamPermissions_async", + "title": "IdentityAwareProxyAdminV1Beta1 testIamPermissions Sample", + "origin": "API_DEFINITION", + "description": " Returns permissions that a caller has on the Identity-Aware Proxy protected resource. If the resource does not exist or the caller does not have Identity-Aware Proxy permissions a [google.rpc.Code.PERMISSION_DENIED] will be returned. More information about managing access via IAP can be found at: https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api", + "canonical": true, + "file": "identity_aware_proxy_admin_v1_beta1.test_iam_permissions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "TestIamPermissions", + "fullName": "google.cloud.iap.v1beta1.IdentityAwareProxyAdminV1Beta1.TestIamPermissions", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "permissions", + "type": "TYPE_STRING[]" + } + ], + "resultType": ".google.iam.v1.TestIamPermissionsResponse", + "client": { + "shortName": "IdentityAwareProxyAdminV1Beta1Client", + "fullName": "google.cloud.iap.v1beta1.IdentityAwareProxyAdminV1Beta1Client" + }, + "method": { + "shortName": "TestIamPermissions", + "fullName": "google.cloud.iap.v1beta1.IdentityAwareProxyAdminV1Beta1.TestIamPermissions", + "service": { + "shortName": "IdentityAwareProxyAdminV1Beta1", + "fullName": "google.cloud.iap.v1beta1.IdentityAwareProxyAdminV1Beta1" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-iap/v1beta1/src/index.ts b/owl-bot-staging/google-cloud-iap/v1beta1/src/index.ts new file mode 100644 index 00000000000..98f130b8f62 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/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 IdentityAwareProxyAdminV1Beta1Client = v1beta1.IdentityAwareProxyAdminV1Beta1Client; +type IdentityAwareProxyAdminV1Beta1Client = v1beta1.IdentityAwareProxyAdminV1Beta1Client; +export {v1beta1, IdentityAwareProxyAdminV1Beta1Client}; +export default {v1beta1, IdentityAwareProxyAdminV1Beta1Client}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-iap/v1beta1/src/v1beta1/gapic_metadata.json b/owl-bot-staging/google-cloud-iap/v1beta1/src/v1beta1/gapic_metadata.json new file mode 100644 index 00000000000..dfebdd030c1 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1beta1/src/v1beta1/gapic_metadata.json @@ -0,0 +1,53 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.iap.v1beta1", + "libraryPackage": "@google-cloud/iap", + "services": { + "IdentityAwareProxyAdminV1Beta1": { + "clients": { + "grpc": { + "libraryClient": "IdentityAwareProxyAdminV1Beta1Client", + "rpcs": { + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "IdentityAwareProxyAdminV1Beta1Client", + "rpcs": { + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-iap/v1beta1/src/v1beta1/identity_aware_proxy_admin_v1_beta1_client.ts b/owl-bot-staging/google-cloud-iap/v1beta1/src/v1beta1/identity_aware_proxy_admin_v1_beta1_client.ts new file mode 100644 index 00000000000..a4d7085bd6a --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1beta1/src/v1beta1/identity_aware_proxy_admin_v1_beta1_client.ts @@ -0,0 +1,553 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1beta1/identity_aware_proxy_admin_v1_beta1_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './identity_aware_proxy_admin_v1_beta1_client_config.json'; +const version = require('../../../package.json').version; + +/** + * APIs for Identity-Aware Proxy Admin configurations. + * @class + * @memberof v1beta1 + */ +export class IdentityAwareProxyAdminV1Beta1Client { + 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}; + identityAwareProxyAdminV1Beta1Stub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of IdentityAwareProxyAdminV1Beta1Client. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new IdentityAwareProxyAdminV1Beta1Client({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof IdentityAwareProxyAdminV1Beta1Client; + 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); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.iap.v1beta1.IdentityAwareProxyAdminV1Beta1', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.identityAwareProxyAdminV1Beta1Stub) { + return this.identityAwareProxyAdminV1Beta1Stub; + } + + // Put together the "service stub" for + // google.cloud.iap.v1beta1.IdentityAwareProxyAdminV1Beta1. + this.identityAwareProxyAdminV1Beta1Stub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.iap.v1beta1.IdentityAwareProxyAdminV1Beta1') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.iap.v1beta1.IdentityAwareProxyAdminV1Beta1, + 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 identityAwareProxyAdminV1Beta1StubMethods = + ['setIamPolicy', 'getIamPolicy', 'testIamPermissions']; + for (const methodName of identityAwareProxyAdminV1Beta1StubMethods) { + const callPromise = this.identityAwareProxyAdminV1Beta1Stub.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 = + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.identityAwareProxyAdminV1Beta1Stub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'iap.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 'iap.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 -- + // ------------------- +/** + * Sets the access control policy for an Identity-Aware Proxy protected + * resource. Replaces any existing policy. + * More information about managing access via IAP can be found at: + * https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being specified. + * See the operation documentation for the appropriate value for this field. + * @param {google.iam.v1.Policy} request.policy + * REQUIRED: The complete policy to be applied to the `resource`. The size of + * the policy is limited to a few 10s of KB. An empty policy is a + * valid policy but certain Cloud Platform services (such as Projects) + * might reject them. + * @param {google.protobuf.FieldMask} request.updateMask + * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only + * the fields in the mask will be modified. If no mask is provided, the + * following default mask is used: + * + * `paths: "bindings, etag"` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta1/identity_aware_proxy_admin_v1_beta1.set_iam_policy.js + * region_tag:iap_v1beta1_generated_IdentityAwareProxyAdminV1Beta1_SetIamPolicy_async + */ + setIamPolicy( + request?: protos.google.iam.v1.ISetIamPolicyRequest, + options?: CallOptions): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined + ]>; + setIamPolicy( + request: protos.google.iam.v1.ISetIamPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; + setIamPolicy( + request: protos.google.iam.v1.ISetIamPolicyRequest, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; + setIamPolicy( + request?: protos.google.iam.v1.ISetIamPolicyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'resource': request.resource ?? '', + }); + this.initialize(); + return this.innerApiCalls.setIamPolicy(request, options, callback); + } +/** + * Gets the access control policy for an Identity-Aware Proxy protected + * resource. + * More information about managing access via IAP can be found at: + * https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {google.iam.v1.GetPolicyOptions} request.options + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta1/identity_aware_proxy_admin_v1_beta1.get_iam_policy.js + * region_tag:iap_v1beta1_generated_IdentityAwareProxyAdminV1Beta1_GetIamPolicy_async + */ + getIamPolicy( + request?: protos.google.iam.v1.IGetIamPolicyRequest, + options?: CallOptions): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined + ]>; + getIamPolicy( + request: protos.google.iam.v1.IGetIamPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; + getIamPolicy( + request: protos.google.iam.v1.IGetIamPolicyRequest, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; + getIamPolicy( + request?: protos.google.iam.v1.IGetIamPolicyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'resource': request.resource ?? '', + }); + this.initialize(); + return this.innerApiCalls.getIamPolicy(request, options, callback); + } +/** + * Returns permissions that a caller has on the Identity-Aware Proxy protected + * resource. If the resource does not exist or the caller does not have + * Identity-Aware Proxy permissions a [google.rpc.Code.PERMISSION_DENIED] + * will be returned. + * More information about managing access via IAP can be found at: + * https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta1/identity_aware_proxy_admin_v1_beta1.test_iam_permissions.js + * region_tag:iap_v1beta1_generated_IdentityAwareProxyAdminV1Beta1_TestIamPermissions_async + */ + testIamPermissions( + request?: protos.google.iam.v1.ITestIamPermissionsRequest, + options?: CallOptions): + Promise<[ + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined + ]>; + testIamPermissions( + request: protos.google.iam.v1.ITestIamPermissionsRequest, + options: CallOptions, + callback: Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>): void; + testIamPermissions( + request: protos.google.iam.v1.ITestIamPermissionsRequest, + callback: Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>): void; + testIamPermissions( + request?: protos.google.iam.v1.ITestIamPermissionsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'resource': request.resource ?? '', + }); + this.initialize(); + return this.innerApiCalls.testIamPermissions(request, options, callback); + } + + + /** + * 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.identityAwareProxyAdminV1Beta1Stub && !this._terminated) { + return this.identityAwareProxyAdminV1Beta1Stub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-iap/v1beta1/src/v1beta1/identity_aware_proxy_admin_v1_beta1_client_config.json b/owl-bot-staging/google-cloud-iap/v1beta1/src/v1beta1/identity_aware_proxy_admin_v1_beta1_client_config.json new file mode 100644 index 00000000000..31b8915b35b --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1beta1/src/v1beta1/identity_aware_proxy_admin_v1_beta1_client_config.json @@ -0,0 +1,41 @@ +{ + "interfaces": { + "google.cloud.iap.v1beta1.IdentityAwareProxyAdminV1Beta1": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "SetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "TestIamPermissions": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-iap/v1beta1/src/v1beta1/identity_aware_proxy_admin_v1_beta1_proto_list.json b/owl-bot-staging/google-cloud-iap/v1beta1/src/v1beta1/identity_aware_proxy_admin_v1_beta1_proto_list.json new file mode 100644 index 00000000000..64f18e846ca --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1beta1/src/v1beta1/identity_aware_proxy_admin_v1_beta1_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/cloud/iap/v1beta1/service.proto" +] diff --git a/owl-bot-staging/google-cloud-iap/v1beta1/src/v1beta1/index.ts b/owl-bot-staging/google-cloud-iap/v1beta1/src/v1beta1/index.ts new file mode 100644 index 00000000000..a5b946a3b8b --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/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 {IdentityAwareProxyAdminV1Beta1Client} from './identity_aware_proxy_admin_v1_beta1_client'; diff --git a/owl-bot-staging/google-cloud-iap/v1beta1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-iap/v1beta1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..033a604d4ac --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/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 iap = require('@google-cloud/iap'); + +function main() { + const identityAwareProxyAdminV1Beta1Client = new iap.IdentityAwareProxyAdminV1Beta1Client(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-iap/v1beta1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-iap/v1beta1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..8439fc955c5 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/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 {IdentityAwareProxyAdminV1Beta1Client} from '@google-cloud/iap'; + +// check that the client class type name can be used +function doStuffWithIdentityAwareProxyAdminV1Beta1Client(client: IdentityAwareProxyAdminV1Beta1Client) { + client.close(); +} + +function main() { + // check that the client instance can be created + const identityAwareProxyAdminV1Beta1Client = new IdentityAwareProxyAdminV1Beta1Client(); + doStuffWithIdentityAwareProxyAdminV1Beta1Client(identityAwareProxyAdminV1Beta1Client); +} + +main(); diff --git a/owl-bot-staging/google-cloud-iap/v1beta1/system-test/install.ts b/owl-bot-staging/google-cloud-iap/v1beta1/system-test/install.ts new file mode 100644 index 00000000000..557a57558e1 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/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/google-cloud-iap/v1beta1/test/gapic_identity_aware_proxy_admin_v1_beta1_v1beta1.ts b/owl-bot-staging/google-cloud-iap/v1beta1/test/gapic_identity_aware_proxy_admin_v1_beta1_v1beta1.ts new file mode 100644 index 00000000000..454f8a99d0e --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1beta1/test/gapic_identity_aware_proxy_admin_v1_beta1_v1beta1.ts @@ -0,0 +1,474 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 identityawareproxyadminv1beta1Module from '../src'; + +import {protobuf} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .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); +} + +describe('v1beta1.IdentityAwareProxyAdminV1Beta1Client', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = identityawareproxyadminv1beta1Module.v1beta1.IdentityAwareProxyAdminV1Beta1Client.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = identityawareproxyadminv1beta1Module.v1beta1.IdentityAwareProxyAdminV1Beta1Client.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = identityawareproxyadminv1beta1Module.v1beta1.IdentityAwareProxyAdminV1Beta1Client.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new identityawareproxyadminv1beta1Module.v1beta1.IdentityAwareProxyAdminV1Beta1Client(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new identityawareproxyadminv1beta1Module.v1beta1.IdentityAwareProxyAdminV1Beta1Client({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new identityawareproxyadminv1beta1Module.v1beta1.IdentityAwareProxyAdminV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.identityAwareProxyAdminV1Beta1Stub, undefined); + await client.initialize(); + assert(client.identityAwareProxyAdminV1Beta1Stub); + }); + + it('has close method for the initialized client', done => { + const client = new identityawareproxyadminv1beta1Module.v1beta1.IdentityAwareProxyAdminV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.identityAwareProxyAdminV1Beta1Stub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new identityawareproxyadminv1beta1Module.v1beta1.IdentityAwareProxyAdminV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.identityAwareProxyAdminV1Beta1Stub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new identityawareproxyadminv1beta1Module.v1beta1.IdentityAwareProxyAdminV1Beta1Client({ + 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 identityawareproxyadminv1beta1Module.v1beta1.IdentityAwareProxyAdminV1Beta1Client({ + 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('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new identityawareproxyadminv1beta1Module.v1beta1.IdentityAwareProxyAdminV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.SetIamPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.SetIamPolicyRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v1.Policy() + ); + client.innerApiCalls.setIamPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.setIamPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setIamPolicy without error using callback', async () => { + const client = new identityawareproxyadminv1beta1Module.v1beta1.IdentityAwareProxyAdminV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.SetIamPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.SetIamPolicyRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v1.Policy() + ); + client.innerApiCalls.setIamPolicy = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setIamPolicy with error', async () => { + const client = new identityawareproxyadminv1beta1Module.v1beta1.IdentityAwareProxyAdminV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.SetIamPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.SetIamPolicyRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setIamPolicy(request), expectedError); + const actualRequest = (client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setIamPolicy with closed client', async () => { + const client = new identityawareproxyadminv1beta1Module.v1beta1.IdentityAwareProxyAdminV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.SetIamPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.SetIamPolicyRequest', ['resource']); + request.resource = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setIamPolicy(request), expectedError); + }); + }); + + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new identityawareproxyadminv1beta1Module.v1beta1.IdentityAwareProxyAdminV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.GetIamPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v1.Policy() + ); + client.innerApiCalls.getIamPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.getIamPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getIamPolicy without error using callback', async () => { + const client = new identityawareproxyadminv1beta1Module.v1beta1.IdentityAwareProxyAdminV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.GetIamPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v1.Policy() + ); + client.innerApiCalls.getIamPolicy = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getIamPolicy with error', async () => { + const client = new identityawareproxyadminv1beta1Module.v1beta1.IdentityAwareProxyAdminV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.GetIamPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIamPolicy(request), expectedError); + const actualRequest = (client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getIamPolicy with closed client', async () => { + const client = new identityawareproxyadminv1beta1Module.v1beta1.IdentityAwareProxyAdminV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.GetIamPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); + request.resource = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getIamPolicy(request), expectedError); + }); + }); + + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new identityawareproxyadminv1beta1Module.v1beta1.IdentityAwareProxyAdminV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.TestIamPermissionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.TestIamPermissionsRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v1.TestIamPermissionsResponse() + ); + client.innerApiCalls.testIamPermissions = stubSimpleCall(expectedResponse); + const [response] = await client.testIamPermissions(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes testIamPermissions without error using callback', async () => { + const client = new identityawareproxyadminv1beta1Module.v1beta1.IdentityAwareProxyAdminV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.TestIamPermissionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.TestIamPermissionsRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v1.TestIamPermissionsResponse() + ); + client.innerApiCalls.testIamPermissions = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + (err?: Error|null, result?: protos.google.iam.v1.ITestIamPermissionsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes testIamPermissions with error', async () => { + const client = new identityawareproxyadminv1beta1Module.v1beta1.IdentityAwareProxyAdminV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.TestIamPermissionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.TestIamPermissionsRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.testIamPermissions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.testIamPermissions(request), expectedError); + const actualRequest = (client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes testIamPermissions with closed client', async () => { + const client = new identityawareproxyadminv1beta1Module.v1beta1.IdentityAwareProxyAdminV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.TestIamPermissionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.iam.v1.TestIamPermissionsRequest', ['resource']); + request.resource = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.testIamPermissions(request), expectedError); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-iap/v1beta1/tsconfig.json b/owl-bot-staging/google-cloud-iap/v1beta1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/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/google-cloud-iap/v1beta1/webpack.config.js b/owl-bot-staging/google-cloud-iap/v1beta1/webpack.config.js new file mode 100644 index 00000000000..e9830a9679b --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/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: 'IdentityAwareProxyAdminV1Beta1', + filename: './identity-aware-proxy-admin-v1-beta1.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 433d95aa60401afa2f772690dadd90b3d8f9c974 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Tue, 20 Dec 2022 20:05:17 +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 --- .../google-cloud-iap/v1/.eslintignore | 7 - .../google-cloud-iap/v1/.eslintrc.json | 3 - .../google-cloud-iap/v1/.gitignore | 14 - owl-bot-staging/google-cloud-iap/v1/.jsdoc.js | 55 - .../google-cloud-iap/v1/.mocharc.js | 33 - .../google-cloud-iap/v1/.prettierrc.js | 22 - owl-bot-staging/google-cloud-iap/v1/README.md | 1 - .../v1/linkinator.config.json | 16 - .../google-cloud-iap/v1/package.json | 65 - .../protos/google/cloud/iap/v1/service.proto | 725 ------- ..._admin_service.create_tunnel_dest_group.js | 76 - ..._admin_service.delete_tunnel_dest_group.js | 63 - ...ware_proxy_admin_service.get_iam_policy.js | 67 - ...re_proxy_admin_service.get_iap_settings.js | 63 - ...oxy_admin_service.get_tunnel_dest_group.js | 63 - ...y_admin_service.list_tunnel_dest_groups.js | 81 - ...ware_proxy_admin_service.set_iam_policy.js | 77 - ...roxy_admin_service.test_iam_permissions.js | 70 - ...proxy_admin_service.update_iap_settings.js | 69 - ..._admin_service.update_tunnel_dest_group.js | 67 - ...aware_proxy_o_auth_service.create_brand.js | 67 - ...vice.create_identity_aware_proxy_client.js | 69 - ...vice.delete_identity_aware_proxy_client.js | 63 - ...ty_aware_proxy_o_auth_service.get_brand.js | 62 - ...service.get_identity_aware_proxy_client.js | 63 - ..._aware_proxy_o_auth_service.list_brands.js | 62 - ...rvice.list_identity_aware_proxy_clients.js | 79 - ...eset_identity_aware_proxy_client_secret.js | 63 - .../snippet_metadata.google.cloud.iap.v1.json | 791 -------- .../google-cloud-iap/v1/src/index.ts | 27 - .../v1/src/v1/gapic_metadata.json | 225 -- ...entity_aware_proxy_admin_service_client.ts | 1348 ------------ ...are_proxy_admin_service_client_config.json | 76 - ..._aware_proxy_admin_service_proto_list.json | 3 - ...ntity_aware_proxy_o_auth_service_client.ts | 1171 ----------- ...re_proxy_o_auth_service_client_config.json | 66 - ...aware_proxy_o_auth_service_proto_list.json | 3 - .../google-cloud-iap/v1/src/v1/index.ts | 20 - .../system-test/fixtures/sample/src/index.js | 28 - .../system-test/fixtures/sample/src/index.ts | 38 - .../v1/system-test/install.ts | 49 - ...c_identity_aware_proxy_admin_service_v1.ts | 1539 -------------- ..._identity_aware_proxy_o_auth_service_v1.ts | 1315 ------------ .../google-cloud-iap/v1/tsconfig.json | 19 - .../google-cloud-iap/v1/webpack.config.js | 64 - .../google-cloud-iap/v1beta1/.eslintignore | 7 - .../google-cloud-iap/v1beta1/.eslintrc.json | 3 - .../google-cloud-iap/v1beta1/.gitignore | 14 - .../google-cloud-iap/v1beta1/.jsdoc.js | 55 - .../google-cloud-iap/v1beta1/.mocharc.js | 33 - .../google-cloud-iap/v1beta1/.prettierrc.js | 22 - .../google-cloud-iap/v1beta1/README.md | 1 - .../v1beta1/linkinator.config.json | 16 - .../google-cloud-iap/v1beta1/package.json | 64 - .../google/cloud/iap/v1beta1/service.proto | 71 - ...are_proxy_admin_v1_beta1.get_iam_policy.js | 67 - ...are_proxy_admin_v1_beta1.set_iam_policy.js | 77 - ...oxy_admin_v1_beta1.test_iam_permissions.js | 70 - ...pet_metadata.google.cloud.iap.v1beta1.json | 151 -- .../google-cloud-iap/v1beta1/src/index.ts | 25 - .../v1beta1/src/v1beta1/gapic_metadata.json | 53 - ...ntity_aware_proxy_admin_v1_beta1_client.ts | 553 ----- ...re_proxy_admin_v1_beta1_client_config.json | 41 - ...aware_proxy_admin_v1_beta1_proto_list.json | 3 - .../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 - ...tity_aware_proxy_admin_v1_beta1_v1beta1.ts | 474 ----- .../google-cloud-iap/v1beta1/tsconfig.json | 19 - .../v1beta1/webpack.config.js | 64 - .../protos/google/cloud/iap/v1/service.proto | 319 ++- packages/google-cloud-iap/protos/protos.d.ts | 735 ++++--- packages/google-cloud-iap/protos/protos.js | 1803 ++++++++++++----- packages/google-cloud-iap/protos/protos.json | 347 ++-- ..._admin_service.create_tunnel_dest_group.js | 6 +- ...entity_aware_proxy_admin_service_client.ts | 9 +- ...ntity_aware_proxy_o_auth_service_client.ts | 3 + ...ntity_aware_proxy_admin_v1_beta1_client.ts | 3 + 79 files changed, 2198 insertions(+), 11984 deletions(-) delete mode 100644 owl-bot-staging/google-cloud-iap/v1/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-iap/v1/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-iap/v1/.gitignore delete mode 100644 owl-bot-staging/google-cloud-iap/v1/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-iap/v1/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-iap/v1/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-iap/v1/README.md delete mode 100644 owl-bot-staging/google-cloud-iap/v1/linkinator.config.json delete mode 100644 owl-bot-staging/google-cloud-iap/v1/package.json delete mode 100644 owl-bot-staging/google-cloud-iap/v1/protos/google/cloud/iap/v1/service.proto delete mode 100644 owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.create_tunnel_dest_group.js delete mode 100644 owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.delete_tunnel_dest_group.js delete mode 100644 owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.get_iam_policy.js delete mode 100644 owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.get_iap_settings.js delete mode 100644 owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.get_tunnel_dest_group.js delete mode 100644 owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.list_tunnel_dest_groups.js delete mode 100644 owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.set_iam_policy.js delete mode 100644 owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.test_iam_permissions.js delete mode 100644 owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.update_iap_settings.js delete mode 100644 owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.update_tunnel_dest_group.js delete mode 100644 owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.create_brand.js delete mode 100644 owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.create_identity_aware_proxy_client.js delete mode 100644 owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.delete_identity_aware_proxy_client.js delete mode 100644 owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.get_brand.js delete mode 100644 owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.get_identity_aware_proxy_client.js delete mode 100644 owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.list_brands.js delete mode 100644 owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.list_identity_aware_proxy_clients.js delete mode 100644 owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.reset_identity_aware_proxy_client_secret.js delete mode 100644 owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/snippet_metadata.google.cloud.iap.v1.json delete mode 100644 owl-bot-staging/google-cloud-iap/v1/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-iap/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_admin_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_admin_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_admin_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_o_auth_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_o_auth_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_o_auth_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-iap/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/google-cloud-iap/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-iap/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-iap/v1/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-iap/v1/test/gapic_identity_aware_proxy_admin_service_v1.ts delete mode 100644 owl-bot-staging/google-cloud-iap/v1/test/gapic_identity_aware_proxy_o_auth_service_v1.ts delete mode 100644 owl-bot-staging/google-cloud-iap/v1/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-iap/v1/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-iap/v1beta1/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-iap/v1beta1/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-iap/v1beta1/.gitignore delete mode 100644 owl-bot-staging/google-cloud-iap/v1beta1/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-iap/v1beta1/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-iap/v1beta1/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-iap/v1beta1/README.md delete mode 100644 owl-bot-staging/google-cloud-iap/v1beta1/linkinator.config.json delete mode 100644 owl-bot-staging/google-cloud-iap/v1beta1/package.json delete mode 100644 owl-bot-staging/google-cloud-iap/v1beta1/protos/google/cloud/iap/v1beta1/service.proto delete mode 100644 owl-bot-staging/google-cloud-iap/v1beta1/samples/generated/v1beta1/identity_aware_proxy_admin_v1_beta1.get_iam_policy.js delete mode 100644 owl-bot-staging/google-cloud-iap/v1beta1/samples/generated/v1beta1/identity_aware_proxy_admin_v1_beta1.set_iam_policy.js delete mode 100644 owl-bot-staging/google-cloud-iap/v1beta1/samples/generated/v1beta1/identity_aware_proxy_admin_v1_beta1.test_iam_permissions.js delete mode 100644 owl-bot-staging/google-cloud-iap/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.iap.v1beta1.json delete mode 100644 owl-bot-staging/google-cloud-iap/v1beta1/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-iap/v1beta1/src/v1beta1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-iap/v1beta1/src/v1beta1/identity_aware_proxy_admin_v1_beta1_client.ts delete mode 100644 owl-bot-staging/google-cloud-iap/v1beta1/src/v1beta1/identity_aware_proxy_admin_v1_beta1_client_config.json delete mode 100644 owl-bot-staging/google-cloud-iap/v1beta1/src/v1beta1/identity_aware_proxy_admin_v1_beta1_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-iap/v1beta1/src/v1beta1/index.ts delete mode 100644 owl-bot-staging/google-cloud-iap/v1beta1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-iap/v1beta1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-iap/v1beta1/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-iap/v1beta1/test/gapic_identity_aware_proxy_admin_v1_beta1_v1beta1.ts delete mode 100644 owl-bot-staging/google-cloud-iap/v1beta1/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-iap/v1beta1/webpack.config.js diff --git a/owl-bot-staging/google-cloud-iap/v1/.eslintignore b/owl-bot-staging/google-cloud-iap/v1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/owl-bot-staging/google-cloud-iap/v1/.eslintrc.json b/owl-bot-staging/google-cloud-iap/v1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-iap/v1/.gitignore b/owl-bot-staging/google-cloud-iap/v1/.gitignore deleted file mode 100644 index 5d32b23782f..00000000000 --- a/owl-bot-staging/google-cloud-iap/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/google-cloud-iap/v1/.jsdoc.js b/owl-bot-staging/google-cloud-iap/v1/.jsdoc.js deleted file mode 100644 index c516e1ec527..00000000000 --- a/owl-bot-staging/google-cloud-iap/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/iap', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-iap/v1/.mocharc.js b/owl-bot-staging/google-cloud-iap/v1/.mocharc.js deleted file mode 100644 index 481c522b00f..00000000000 --- a/owl-bot-staging/google-cloud-iap/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/google-cloud-iap/v1/.prettierrc.js b/owl-bot-staging/google-cloud-iap/v1/.prettierrc.js deleted file mode 100644 index 494e147865d..00000000000 --- a/owl-bot-staging/google-cloud-iap/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/google-cloud-iap/v1/README.md b/owl-bot-staging/google-cloud-iap/v1/README.md deleted file mode 100644 index 1ede6beeb65..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Iap: Nodejs Client diff --git a/owl-bot-staging/google-cloud-iap/v1/linkinator.config.json b/owl-bot-staging/google-cloud-iap/v1/linkinator.config.json deleted file mode 100644 index befd23c8633..00000000000 --- a/owl-bot-staging/google-cloud-iap/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/google-cloud-iap/v1/package.json b/owl-bot-staging/google-cloud-iap/v1/package.json deleted file mode 100644 index b8fb0760d5e..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1/package.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "name": "@google-cloud/iap", - "version": "0.1.0", - "description": "Iap client for Node.js", - "repository": "googleapis/nodejs-iap", - "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 iap", - "iap", - "identity aware proxy admin service", - "identity aware proxy o auth service" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "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.5.2" - }, - "devDependencies": { - "@types/mocha": "^9.1.1", - "@types/node": "^16.11.62", - "@types/sinon": "^10.0.13", - "c8": "^7.12.0", - "gts": "^3.1.1", - "jsdoc": "^3.6.11", - "jsdoc-fresh": "^2.0.1", - "jsdoc-region-tag": "^2.0.1", - "linkinator": "^4.0.3", - "mocha": "^10.0.0", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^14.0.0", - "ts-loader": "^8.4.0", - "typescript": "^4.8.3", - "webpack": "^4.46.0", - "webpack-cli": "^4.10.0" - }, - "engines": { - "node": ">=v12" - } -} diff --git a/owl-bot-staging/google-cloud-iap/v1/protos/google/cloud/iap/v1/service.proto b/owl-bot-staging/google-cloud-iap/v1/protos/google/cloud/iap/v1/service.proto deleted file mode 100644 index 919009292c4..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1/protos/google/cloud/iap/v1/service.proto +++ /dev/null @@ -1,725 +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.iap.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/iam/v1/iam_policy.proto"; -import "google/iam/v1/policy.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/wrappers.proto"; - -option csharp_namespace = "Google.Cloud.Iap.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/iap/v1;iap"; -option java_multiple_files = true; -option java_package = "com.google.cloud.iap.v1"; -option php_namespace = "Google\\Cloud\\Iap\\V1"; -option ruby_package = "Google::Cloud::Iap::V1"; -option (google.api.resource_definition) = { - type: "iap.googleapis.com/TunnelLocation" - pattern: "projects/{project}/iap_tunnel/locations/{location}" -}; - -// The Cloud Identity-Aware Proxy API. - -// APIs for Identity-Aware Proxy Admin configurations. -service IdentityAwareProxyAdminService { - option (google.api.default_host) = "iap.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Sets the access control policy for an Identity-Aware Proxy protected - // resource. Replaces any existing policy. - // More information about managing access via IAP can be found at: - // https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api - rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) - returns (google.iam.v1.Policy) { - option (google.api.http) = { - post: "/v1/{resource=**}:setIamPolicy" - body: "*" - }; - } - - // Gets the access control policy for an Identity-Aware Proxy protected - // resource. - // More information about managing access via IAP can be found at: - // https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api - rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) - returns (google.iam.v1.Policy) { - option (google.api.http) = { - post: "/v1/{resource=**}:getIamPolicy" - body: "*" - }; - } - - // Returns permissions that a caller has on the Identity-Aware Proxy protected - // resource. - // More information about managing access via IAP can be found at: - // https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api - rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) - returns (google.iam.v1.TestIamPermissionsResponse) { - option (google.api.http) = { - post: "/v1/{resource=**}:testIamPermissions" - body: "*" - }; - } - - // Gets the IAP settings on a particular IAP protected resource. - rpc GetIapSettings(GetIapSettingsRequest) returns (IapSettings) { - option (google.api.http) = { - get: "/v1/{name=**}:iapSettings" - }; - } - - // Updates the IAP settings on a particular IAP protected resource. It - // replaces all fields unless the `update_mask` is set. - rpc UpdateIapSettings(UpdateIapSettingsRequest) returns (IapSettings) { - option (google.api.http) = { - patch: "/v1/{iap_settings.name=**}:iapSettings" - body: "iap_settings" - }; - } - - // Lists the existing TunnelDestGroups. To group across all locations, use a - // `-` as the location ID. For example: - // `/v1/projects/123/iap_tunnel/locations/-/destGroups` - rpc ListTunnelDestGroups(ListTunnelDestGroupsRequest) - returns (ListTunnelDestGroupsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/iap_tunnel/locations/*}/destGroups" - }; - option (google.api.method_signature) = "parent"; - } - - // Creates a new TunnelDestGroup. - rpc CreateTunnelDestGroup(CreateTunnelDestGroupRequest) - returns (TunnelDestGroup) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/iap_tunnel/locations/*}/destGroups" - body: "tunnel_dest_group" - }; - option (google.api.method_signature) = - "parent,tunnel_dest_group,tunnel_dest_group_id"; - } - - // Retrieves an existing TunnelDestGroup. - rpc GetTunnelDestGroup(GetTunnelDestGroupRequest) returns (TunnelDestGroup) { - option (google.api.http) = { - get: "/v1/{name=projects/*/iap_tunnel/locations/*/destGroups/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Deletes a TunnelDestGroup. - rpc DeleteTunnelDestGroup(DeleteTunnelDestGroupRequest) - returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/iap_tunnel/locations/*/destGroups/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Updates a TunnelDestGroup. - rpc UpdateTunnelDestGroup(UpdateTunnelDestGroupRequest) - returns (TunnelDestGroup) { - option (google.api.http) = { - patch: "/v1/{tunnel_dest_group.name=projects/*/iap_tunnel/locations/*/destGroups/*}" - body: "tunnel_dest_group" - }; - option (google.api.method_signature) = "tunnel_dest_group,update_mask"; - } -} - -// The request to ListTunnelDestGroups. -message ListTunnelDestGroupsRequest { - // Required. Google Cloud Project ID and location. - // In the following format: - // `projects/{project_number/id}/iap_tunnel/locations/{location}`. - // A `-` can be used for the location to group across all locations. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "iap.googleapis.com/TunnelLocation" - } - ]; - - // The maximum number of groups to return. The service might return fewer than - // this value. - // If unspecified, at most 100 groups are returned. - // The maximum value is 1000; values above 1000 are coerced to 1000. - int32 page_size = 2; - - // A page token, received from a previous `ListTunnelDestGroups` - // call. Provide this to retrieve the subsequent page. - // - // When paginating, all other parameters provided to - // `ListTunnelDestGroups` must match the call that provided the page - // token. - string page_token = 3; -} - -// The response from ListTunnelDestGroups. -message ListTunnelDestGroupsResponse { - // TunnelDestGroup existing in the project. - repeated TunnelDestGroup tunnel_dest_groups = 1; - - // A token that you can send as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. - string next_page_token = 2; -} - -// The request to CreateTunnelDestGroup. -message CreateTunnelDestGroupRequest { - // Required. Google Cloud Project ID and location. - // In the following format: - // `projects/{project_number/id}/iap_tunnel/locations/{location}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "iap.googleapis.com/TunnelDestGroup" - } - ]; - - // Required. The TunnelDestGroup to create. - TunnelDestGroup tunnel_dest_group = 2 - [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID to use for the TunnelDestGroup, which becomes the final - // component of the resource name. - // - // This value must be 4-63 characters, and valid characters - // are `[a-z]-`. - string tunnel_dest_group_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// The request to GetTunnelDestGroup. -message GetTunnelDestGroupRequest { - // Required. Name of the TunnelDestGroup to be fetched. - // In the following format: - // `projects/{project_number/id}/iap_tunnel/locations/{location}/destGroups/{dest_group}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "iap.googleapis.com/TunnelDestGroup" - } - ]; -} - -// The request to DeleteTunnelDestGroup. -message DeleteTunnelDestGroupRequest { - // Required. Name of the TunnelDestGroup to delete. - // In the following format: - // `projects/{project_number/id}/iap_tunnel/locations/{location}/destGroups/{dest_group}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "iap.googleapis.com/TunnelDestGroup" - } - ]; -} - -// The request to UpdateTunnelDestGroup. -message UpdateTunnelDestGroupRequest { - // Required. The new values for the TunnelDestGroup. - TunnelDestGroup tunnel_dest_group = 1 - [(google.api.field_behavior) = REQUIRED]; - - // A field mask that specifies which IAP settings to update. - // If omitted, then all of the settings are updated. See - // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask - google.protobuf.FieldMask update_mask = 2; -} - -// A TunnelDestGroup. -message TunnelDestGroup { - option (google.api.resource) = { - type: "iap.googleapis.com/TunnelDestGroup" - pattern: "projects/{project}/iap_tunnel/locations/{location}/destGroups/{dest_group}" - }; - - // Required. Immutable. Identifier for the TunnelDestGroup. Must be unique - // within the project and contain only lower case letters (a-z) and dashes - // (-). - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.field_behavior) = IMMUTABLE - ]; - - // Unordered list. List of CIDRs that this group applies to. - repeated string cidrs = 2 [(google.api.field_behavior) = UNORDERED_LIST]; - - // Unordered list. List of FQDNs that this group applies to. - repeated string fqdns = 3 [(google.api.field_behavior) = UNORDERED_LIST]; -} - -// The request sent to GetIapSettings. -message GetIapSettingsRequest { - // Required. The resource name for which to retrieve the settings. - // Authorization: Requires the `getSettings` permission for the associated - // resource. - string name = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// The request sent to UpdateIapSettings. -message UpdateIapSettingsRequest { - // Required. The new values for the IAP settings to be updated. - // Authorization: Requires the `updateSettings` permission for the associated - // resource. - IapSettings iap_settings = 1 [(google.api.field_behavior) = REQUIRED]; - - // The field mask specifying which IAP settings should be updated. - // If omitted, the all of the settings are updated. See - // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask - google.protobuf.FieldMask update_mask = 2; -} - -// The IAP configurable settings. -message IapSettings { - // Required. The resource name of the IAP protected resource. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Top level wrapper for all access related setting in IAP - AccessSettings access_settings = 5; - - // Top level wrapper for all application related settings in IAP - ApplicationSettings application_settings = 6; -} - -// Access related settings for IAP protected apps. -message AccessSettings { - // GCIP claims and endpoint configurations for 3p identity providers. - GcipSettings gcip_settings = 1; - - // Configuration to allow cross-origin requests via IAP. - CorsSettings cors_settings = 2; - - // Settings to configure IAP's OAuth behavior. - OAuthSettings oauth_settings = 3; - - // Settings to configure reauthentication policies in IAP. - ReauthSettings reauth_settings = 6; - - // Settings to configure and enable allowed domains. - AllowedDomainsSettings allowed_domains_settings = 7; -} - -// Allows customers to configure tenant_id for GCIP instance per-app. -message GcipSettings { - // GCIP tenant ids that are linked to the IAP resource. - // tenant_ids could be a string beginning with a number character to indicate - // authenticating with GCIP tenant flow, or in the format of _ - // to indicate authenticating with GCIP agent flow. - // If agent flow is used, tenant_ids should only contain one single element, - // while for tenant flow, tenant_ids can contain multiple elements. - repeated string tenant_ids = 1; - - // Login page URI associated with the GCIP tenants. - // Typically, all resources within the same project share the same login page, - // though it could be overridden at the sub resource level. - google.protobuf.StringValue login_page_uri = 2; -} - -// Allows customers to configure HTTP request paths that'll allow HTTP OPTIONS -// call to bypass authentication and authorization. -message CorsSettings { - // Configuration to allow HTTP OPTIONS calls to skip authorization. If - // undefined, IAP will not apply any special logic to OPTIONS requests. - google.protobuf.BoolValue allow_http_options = 1; -} - -// Configuration for OAuth login&consent flow behavior as well as for OAuth -// Credentials. -message OAuthSettings { - // Domain hint to send as hd=? parameter in OAuth request flow. Enables - // redirect to primary IDP by skipping Google's login screen. - // https://developers.google.com/identity/protocols/OpenIDConnect#hd-param - // Note: IAP does not verify that the id token's hd claim matches this value - // since access behavior is managed by IAM policies. - google.protobuf.StringValue login_hint = 2; -} - -// Configuration for IAP reauthentication policies. -message ReauthSettings { - // Types of reauthentication methods supported by IAP. - enum Method { - // Reauthentication disabled. - METHOD_UNSPECIFIED = 0; - - // Prompts the user to log in again. - LOGIN = 1; - - // Deprecated, no longer accepted by IAP APIs. - PASSWORD = 2 [deprecated = true]; - - // User must use their secure key 2nd factor device. - SECURE_KEY = 3; - } - - // Type of policy in the case of hierarchial policies. - enum PolicyType { - // Default value. This value is unused. - POLICY_TYPE_UNSPECIFIED = 0; - - // This policy acts as a minimum to other policies, lower in the hierarchy. - // Effective policy may only be the same or stricter. - MINIMUM = 1; - - // This policy acts as a default if no other reauth policy is set. - DEFAULT = 2; - } - - // Reauth method requested. - Method method = 1; - - // Reauth session lifetime, how long before a user has to reauthenticate - // again. - google.protobuf.Duration max_age = 2; - - // How IAP determines the effective policy in cases of hierarchial policies. - // Policies are merged from higher in the hierarchy to lower in the hierarchy. - PolicyType policy_type = 3; -} - -// Configuration for IAP allowed domains. Lets you to restrict access to an app -// and allow access to only the domains that you list. -message AllowedDomainsSettings { - // Configuration for customers to opt in for the feature. - optional bool enable = 1; - - // List of trusted domains. - repeated string domains = 2; -} - -// Wrapper over application specific settings for IAP. -message ApplicationSettings { - // Settings to configure IAP's behavior for a service mesh. - CsmSettings csm_settings = 1; - - // Customization for Access Denied page. - AccessDeniedPageSettings access_denied_page_settings = 2; - - // The Domain value to set for cookies generated by IAP. This value is not - // validated by the API, but will be ignored at runtime if invalid. - google.protobuf.StringValue cookie_domain = 3; - - // Settings to configure attribute propagation. - AttributePropagationSettings attribute_propagation_settings = 4; -} - -// Configuration for RCToken generated for service mesh workloads protected by -// IAP. RCToken are IAP generated JWTs that can be verified at the application. -// The RCToken is primarily used for service mesh deployments, and can be scoped -// to a single mesh by configuring the audience field accordingly. -message CsmSettings { - // Audience claim set in the generated RCToken. This value is not validated by - // IAP. - google.protobuf.StringValue rctoken_aud = 1; -} - -// Custom content configuration for access denied page. -// IAP allows customers to define a custom URI to use as the error page when -// access is denied to users. If IAP prevents access to this page, the default -// IAP error page will be displayed instead. -message AccessDeniedPageSettings { - // The URI to be redirected to when access is denied. - google.protobuf.StringValue access_denied_page_uri = 1; - - // Whether to generate a troubleshooting URL on access denied events to this - // application. - google.protobuf.BoolValue generate_troubleshooting_uri = 2; - - // Whether to generate remediation token on access denied events to this - // application. - optional google.protobuf.BoolValue remediation_token_generation_enabled = 3; -} - -// Configuration for propagating attributes to applications protected -// by IAP. -message AttributePropagationSettings { - // Supported output credentials for attribute propagation. Each output - // credential maps to a "field" in the response. For example, selecting JWT - // will propagate all attributes in the IAP JWT, header in the headers, etc. - enum OutputCredentials { - // No output credential. This is an unsupported default. - OUTPUT_CREDENTIALS_UNSPECIFIED = 0; - - // Propagate attributes in the headers with "x-goog-iap-attr-" prefix. - HEADER = 1; - - // Propagate attributes in the JWT of the form: `"additional_claims": { - // "my_attribute": ["value1", "value2"] }` - JWT = 2; - - // Propagate attributes in the RCToken of the form: `"additional_claims": { - // "my_attribute": ["value1", "value2"] }` - RCTOKEN = 3; - } - - // Raw string CEL expression. Must return a list of attributes. Maximum of 45 - // attributes can be selected. Expressions can select different attribute - // types from `attributes`: `attributes.saml_attributes`, - // `attributes.iap_attributes`. Limited functions are supported: - // - `filter: .filter(, )` -> returns a subset of - // `` where `` is true for every item. - // - `in: in ` -> returns true if `` contains `` - // - `selectByName: .selectByName()` -> returns the attribute - // in - // `` with the given `` name, otherwise returns empty. - // - `emitAs: .emitAs()` -> sets the `` name - // field to the given `` for propagation in selected output - // credentials. - // - `strict: .strict()` -> ignore the `x-goog-iap-attr-` prefix - // for the provided `` when propagating via the `HEADER` output - // credential, i.e. request headers. - // - `append: .append()` OR - // `.append()` -> append the provided `` or - // `` onto the end of ``. - // - // Example expression: `attributes.saml_attributes.filter(x, x.name in - // ['test']).append(attributes.iap_attributes.selectByName('exact').emitAs('custom').strict())` - optional string expression = 1; - - // Which output credentials attributes selected by the CEL expression should - // be propagated in. All attributes will be fully duplicated in each selected - // output credential. - repeated OutputCredentials output_credentials = 2; - - // Whether the provided attribute propagation settings should be evaluated on - // user requests. If set to true, attributes returned from the expression will - // be propagated in the set output credentials. - optional bool enable = 3; -} - -// API to programmatically create, list and retrieve Identity Aware Proxy (IAP) -// OAuth brands; and create, retrieve, delete and reset-secret of IAP OAuth -// clients. -service IdentityAwareProxyOAuthService { - option (google.api.default_host) = "iap.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Lists the existing brands for the project. - rpc ListBrands(ListBrandsRequest) returns (ListBrandsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*}/brands" - }; - } - - // Constructs a new OAuth brand for the project if one does not exist. - // The created brand is "internal only", meaning that OAuth clients created - // under it only accept requests from users who belong to the same Google - // Workspace organization as the project. The brand is created in an - // un-reviewed status. NOTE: The "internal only" status can be manually - // changed in the Google Cloud Console. Requires that a brand does not already - // exist for the project, and that the specified support email is owned by the - // caller. - rpc CreateBrand(CreateBrandRequest) returns (Brand) { - option (google.api.http) = { - post: "/v1/{parent=projects/*}/brands" - body: "brand" - }; - } - - // Retrieves the OAuth brand of the project. - rpc GetBrand(GetBrandRequest) returns (Brand) { - option (google.api.http) = { - get: "/v1/{name=projects/*/brands/*}" - }; - } - - // Creates an Identity Aware Proxy (IAP) OAuth client. The client is owned - // by IAP. Requires that the brand for the project exists and that it is - // set for internal-only use. - rpc CreateIdentityAwareProxyClient(CreateIdentityAwareProxyClientRequest) - returns (IdentityAwareProxyClient) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/brands/*}/identityAwareProxyClients" - body: "identity_aware_proxy_client" - }; - } - - // Lists the existing clients for the brand. - rpc ListIdentityAwareProxyClients(ListIdentityAwareProxyClientsRequest) - returns (ListIdentityAwareProxyClientsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/brands/*}/identityAwareProxyClients" - }; - } - - // Retrieves an Identity Aware Proxy (IAP) OAuth client. - // Requires that the client is owned by IAP. - rpc GetIdentityAwareProxyClient(GetIdentityAwareProxyClientRequest) - returns (IdentityAwareProxyClient) { - option (google.api.http) = { - get: "/v1/{name=projects/*/brands/*/identityAwareProxyClients/*}" - }; - } - - // Resets an Identity Aware Proxy (IAP) OAuth client secret. Useful if the - // secret was compromised. Requires that the client is owned by IAP. - rpc ResetIdentityAwareProxyClientSecret( - ResetIdentityAwareProxyClientSecretRequest) - returns (IdentityAwareProxyClient) { - option (google.api.http) = { - post: "/v1/{name=projects/*/brands/*/identityAwareProxyClients/*}:resetSecret" - body: "*" - }; - } - - // Deletes an Identity Aware Proxy (IAP) OAuth client. Useful for removing - // obsolete clients, managing the number of clients in a given project, and - // cleaning up after tests. Requires that the client is owned by IAP. - rpc DeleteIdentityAwareProxyClient(DeleteIdentityAwareProxyClientRequest) - returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/brands/*/identityAwareProxyClients/*}" - }; - } -} - -// The request sent to ListBrands. -message ListBrandsRequest { - // Required. GCP Project number/id. - // In the following format: projects/{project_number/id}. - string parent = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Response message for ListBrands. -message ListBrandsResponse { - // Brands existing in the project. - repeated Brand brands = 1; -} - -// The request sent to CreateBrand. -message CreateBrandRequest { - // Required. GCP Project number/id under which the brand is to be created. - // In the following format: projects/{project_number/id}. - string parent = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The brand to be created. - Brand brand = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The request sent to GetBrand. -message GetBrandRequest { - // Required. Name of the brand to be fetched. - // In the following format: projects/{project_number/id}/brands/{brand}. - string name = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// The request sent to ListIdentityAwareProxyClients. -message ListIdentityAwareProxyClientsRequest { - // Required. Full brand path. - // In the following format: projects/{project_number/id}/brands/{brand}. - string parent = 1 [(google.api.field_behavior) = REQUIRED]; - - // The maximum number of clients to return. The service may return fewer than - // this value. - // If unspecified, at most 100 clients will be returned. - // The maximum value is 1000; values above 1000 will be coerced to 1000. - int32 page_size = 2; - - // A page token, received from a previous `ListIdentityAwareProxyClients` - // call. Provide this to retrieve the subsequent page. - // - // When paginating, all other parameters provided to - // `ListIdentityAwareProxyClients` must match the call that provided the page - // token. - string page_token = 3; -} - -// Response message for ListIdentityAwareProxyClients. -message ListIdentityAwareProxyClientsResponse { - // Clients existing in the brand. - repeated IdentityAwareProxyClient identity_aware_proxy_clients = 1; - - // A token, which can be send as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. - string next_page_token = 2; -} - -// The request sent to CreateIdentityAwareProxyClient. -message CreateIdentityAwareProxyClientRequest { - // Required. Path to create the client in. - // In the following format: - // projects/{project_number/id}/brands/{brand}. - // The project must belong to a G Suite account. - string parent = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Identity Aware Proxy Client to be created. - IdentityAwareProxyClient identity_aware_proxy_client = 2 - [(google.api.field_behavior) = REQUIRED]; -} - -// The request sent to GetIdentityAwareProxyClient. -message GetIdentityAwareProxyClientRequest { - // Required. Name of the Identity Aware Proxy client to be fetched. - // In the following format: - // projects/{project_number/id}/brands/{brand}/identityAwareProxyClients/{client_id}. - string name = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// The request sent to ResetIdentityAwareProxyClientSecret. -message ResetIdentityAwareProxyClientSecretRequest { - // Required. Name of the Identity Aware Proxy client to that will have its - // secret reset. In the following format: - // projects/{project_number/id}/brands/{brand}/identityAwareProxyClients/{client_id}. - string name = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// The request sent to DeleteIdentityAwareProxyClient. -message DeleteIdentityAwareProxyClientRequest { - // Required. Name of the Identity Aware Proxy client to be deleted. - // In the following format: - // projects/{project_number/id}/brands/{brand}/identityAwareProxyClients/{client_id}. - string name = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// OAuth brand data. -// NOTE: Only contains a portion of the data that describes a brand. -message Brand { - // Output only. Identifier of the brand. - // NOTE: GCP project number achieves the same brand identification purpose as - // only one brand per project can be created. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Support email displayed on the OAuth consent screen. - string support_email = 2; - - // Application name displayed on OAuth consent screen. - string application_title = 3; - - // Output only. Whether the brand is only intended for usage inside the - // G Suite organization only. - bool org_internal_only = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Contains the data that describes an Identity Aware Proxy owned client. -message IdentityAwareProxyClient { - // Output only. Unique identifier of the OAuth client. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Client secret of the OAuth client. - string secret = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Human-friendly name given to the OAuth client. - string display_name = 3; -} diff --git a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.create_tunnel_dest_group.js b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.create_tunnel_dest_group.js deleted file mode 100644 index 65f5a9dbad4..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.create_tunnel_dest_group.js +++ /dev/null @@ -1,76 +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, tunnelDestGroup, tunnelDestGroupId) { - // [START iap_v1_generated_IdentityAwareProxyAdminService_CreateTunnelDestGroup_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Google Cloud Project ID and location. - * In the following format: - * `projects/{project_number/id}/iap_tunnel/locations/{location}`. - */ - // const parent = 'abc123' - /** - * Required. The TunnelDestGroup to create. - */ - // const tunnelDestGroup = {} - /** - * Required. The ID to use for the TunnelDestGroup, which becomes the final - * component of the resource name. - * This value must be 4-63 characters, and valid characters - * are `[a-z]-`. - */ - // const tunnelDestGroupId = 'abc123' - - // Imports the Iap library - const {IdentityAwareProxyAdminServiceClient} = require('@google-cloud/iap').v1; - - // Instantiates a client - const iapClient = new IdentityAwareProxyAdminServiceClient(); - - async function callCreateTunnelDestGroup() { - // Construct request - const request = { - parent, - tunnelDestGroup, - tunnelDestGroupId, - }; - - // Run request - const response = await iapClient.createTunnelDestGroup(request); - console.log(response); - } - - callCreateTunnelDestGroup(); - // [END iap_v1_generated_IdentityAwareProxyAdminService_CreateTunnelDestGroup_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.delete_tunnel_dest_group.js b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.delete_tunnel_dest_group.js deleted file mode 100644 index 2772cd70c2b..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.delete_tunnel_dest_group.js +++ /dev/null @@ -1,63 +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 iap_v1_generated_IdentityAwareProxyAdminService_DeleteTunnelDestGroup_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the TunnelDestGroup to delete. - * In the following format: - * `projects/{project_number/id}/iap_tunnel/locations/{location}/destGroups/{dest_group}`. - */ - // const name = 'abc123' - - // Imports the Iap library - const {IdentityAwareProxyAdminServiceClient} = require('@google-cloud/iap').v1; - - // Instantiates a client - const iapClient = new IdentityAwareProxyAdminServiceClient(); - - async function callDeleteTunnelDestGroup() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await iapClient.deleteTunnelDestGroup(request); - console.log(response); - } - - callDeleteTunnelDestGroup(); - // [END iap_v1_generated_IdentityAwareProxyAdminService_DeleteTunnelDestGroup_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.get_iam_policy.js b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.get_iam_policy.js deleted file mode 100644 index 1a961128b5c..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.get_iam_policy.js +++ /dev/null @@ -1,67 +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(resource) { - // [START iap_v1_generated_IdentityAwareProxyAdminService_GetIamPolicy_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - */ - // const resource = 'abc123' - /** - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. - */ - // const options = {} - - // Imports the Iap library - const {IdentityAwareProxyAdminServiceClient} = require('@google-cloud/iap').v1; - - // Instantiates a client - const iapClient = new IdentityAwareProxyAdminServiceClient(); - - async function callGetIamPolicy() { - // Construct request - const request = { - resource, - }; - - // Run request - const response = await iapClient.getIamPolicy(request); - console.log(response); - } - - callGetIamPolicy(); - // [END iap_v1_generated_IdentityAwareProxyAdminService_GetIamPolicy_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.get_iap_settings.js b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.get_iap_settings.js deleted file mode 100644 index f42d62c44eb..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.get_iap_settings.js +++ /dev/null @@ -1,63 +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 iap_v1_generated_IdentityAwareProxyAdminService_GetIapSettings_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name for which to retrieve the settings. - * Authorization: Requires the `getSettings` permission for the associated - * resource. - */ - // const name = 'abc123' - - // Imports the Iap library - const {IdentityAwareProxyAdminServiceClient} = require('@google-cloud/iap').v1; - - // Instantiates a client - const iapClient = new IdentityAwareProxyAdminServiceClient(); - - async function callGetIapSettings() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await iapClient.getIapSettings(request); - console.log(response); - } - - callGetIapSettings(); - // [END iap_v1_generated_IdentityAwareProxyAdminService_GetIapSettings_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.get_tunnel_dest_group.js b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.get_tunnel_dest_group.js deleted file mode 100644 index c7529a0ac56..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.get_tunnel_dest_group.js +++ /dev/null @@ -1,63 +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 iap_v1_generated_IdentityAwareProxyAdminService_GetTunnelDestGroup_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the TunnelDestGroup to be fetched. - * In the following format: - * `projects/{project_number/id}/iap_tunnel/locations/{location}/destGroups/{dest_group}`. - */ - // const name = 'abc123' - - // Imports the Iap library - const {IdentityAwareProxyAdminServiceClient} = require('@google-cloud/iap').v1; - - // Instantiates a client - const iapClient = new IdentityAwareProxyAdminServiceClient(); - - async function callGetTunnelDestGroup() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await iapClient.getTunnelDestGroup(request); - console.log(response); - } - - callGetTunnelDestGroup(); - // [END iap_v1_generated_IdentityAwareProxyAdminService_GetTunnelDestGroup_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.list_tunnel_dest_groups.js b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.list_tunnel_dest_groups.js deleted file mode 100644 index c1b43d8d378..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.list_tunnel_dest_groups.js +++ /dev/null @@ -1,81 +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 iap_v1_generated_IdentityAwareProxyAdminService_ListTunnelDestGroups_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Google Cloud Project ID and location. - * In the following format: - * `projects/{project_number/id}/iap_tunnel/locations/{location}`. - * A `-` can be used for the location to group across all locations. - */ - // const parent = 'abc123' - /** - * The maximum number of groups to return. The service might return fewer than - * this value. - * If unspecified, at most 100 groups are returned. - * The maximum value is 1000; values above 1000 are coerced to 1000. - */ - // const pageSize = 1234 - /** - * A page token, received from a previous `ListTunnelDestGroups` - * call. Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to - * `ListTunnelDestGroups` must match the call that provided the page - * token. - */ - // const pageToken = 'abc123' - - // Imports the Iap library - const {IdentityAwareProxyAdminServiceClient} = require('@google-cloud/iap').v1; - - // Instantiates a client - const iapClient = new IdentityAwareProxyAdminServiceClient(); - - async function callListTunnelDestGroups() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await iapClient.listTunnelDestGroupsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListTunnelDestGroups(); - // [END iap_v1_generated_IdentityAwareProxyAdminService_ListTunnelDestGroups_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.set_iam_policy.js b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.set_iam_policy.js deleted file mode 100644 index 1542add1133..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.set_iam_policy.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(resource, policy) { - // [START iap_v1_generated_IdentityAwareProxyAdminService_SetIamPolicy_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - */ - // const resource = 'abc123' - /** - * REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - */ - // const policy = {} - /** - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * `paths: "bindings, etag"` - */ - // const updateMask = {} - - // Imports the Iap library - const {IdentityAwareProxyAdminServiceClient} = require('@google-cloud/iap').v1; - - // Instantiates a client - const iapClient = new IdentityAwareProxyAdminServiceClient(); - - async function callSetIamPolicy() { - // Construct request - const request = { - resource, - policy, - }; - - // Run request - const response = await iapClient.setIamPolicy(request); - console.log(response); - } - - callSetIamPolicy(); - // [END iap_v1_generated_IdentityAwareProxyAdminService_SetIamPolicy_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.test_iam_permissions.js b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.test_iam_permissions.js deleted file mode 100644 index b0cbaf639ef..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.test_iam_permissions.js +++ /dev/null @@ -1,70 +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(resource, permissions) { - // [START iap_v1_generated_IdentityAwareProxyAdminService_TestIamPermissions_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - */ - // const resource = 'abc123' - /** - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * IAM Overview (https://cloud.google.com/iam/docs/overview#permissions). - */ - // const permissions = 'abc123' - - // Imports the Iap library - const {IdentityAwareProxyAdminServiceClient} = require('@google-cloud/iap').v1; - - // Instantiates a client - const iapClient = new IdentityAwareProxyAdminServiceClient(); - - async function callTestIamPermissions() { - // Construct request - const request = { - resource, - permissions, - }; - - // Run request - const response = await iapClient.testIamPermissions(request); - console.log(response); - } - - callTestIamPermissions(); - // [END iap_v1_generated_IdentityAwareProxyAdminService_TestIamPermissions_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.update_iap_settings.js b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.update_iap_settings.js deleted file mode 100644 index 103bb7c575e..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.update_iap_settings.js +++ /dev/null @@ -1,69 +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(iapSettings) { - // [START iap_v1_generated_IdentityAwareProxyAdminService_UpdateIapSettings_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The new values for the IAP settings to be updated. - * Authorization: Requires the `updateSettings` permission for the associated - * resource. - */ - // const iapSettings = {} - /** - * The field mask specifying which IAP settings should be updated. - * If omitted, the all of the settings are updated. See - * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask - */ - // const updateMask = {} - - // Imports the Iap library - const {IdentityAwareProxyAdminServiceClient} = require('@google-cloud/iap').v1; - - // Instantiates a client - const iapClient = new IdentityAwareProxyAdminServiceClient(); - - async function callUpdateIapSettings() { - // Construct request - const request = { - iapSettings, - }; - - // Run request - const response = await iapClient.updateIapSettings(request); - console.log(response); - } - - callUpdateIapSettings(); - // [END iap_v1_generated_IdentityAwareProxyAdminService_UpdateIapSettings_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.update_tunnel_dest_group.js b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.update_tunnel_dest_group.js deleted file mode 100644 index 69af6638533..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.update_tunnel_dest_group.js +++ /dev/null @@ -1,67 +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(tunnelDestGroup) { - // [START iap_v1_generated_IdentityAwareProxyAdminService_UpdateTunnelDestGroup_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The new values for the TunnelDestGroup. - */ - // const tunnelDestGroup = {} - /** - * A field mask that specifies which IAP settings to update. - * If omitted, then all of the settings are updated. See - * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask - */ - // const updateMask = {} - - // Imports the Iap library - const {IdentityAwareProxyAdminServiceClient} = require('@google-cloud/iap').v1; - - // Instantiates a client - const iapClient = new IdentityAwareProxyAdminServiceClient(); - - async function callUpdateTunnelDestGroup() { - // Construct request - const request = { - tunnelDestGroup, - }; - - // Run request - const response = await iapClient.updateTunnelDestGroup(request); - console.log(response); - } - - callUpdateTunnelDestGroup(); - // [END iap_v1_generated_IdentityAwareProxyAdminService_UpdateTunnelDestGroup_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.create_brand.js b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.create_brand.js deleted file mode 100644 index bf3d1aa108e..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.create_brand.js +++ /dev/null @@ -1,67 +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, brand) { - // [START iap_v1_generated_IdentityAwareProxyOAuthService_CreateBrand_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. GCP Project number/id under which the brand is to be created. - * In the following format: projects/{project_number/id}. - */ - // const parent = 'abc123' - /** - * Required. The brand to be created. - */ - // const brand = {} - - // Imports the Iap library - const {IdentityAwareProxyOAuthServiceClient} = require('@google-cloud/iap').v1; - - // Instantiates a client - const iapClient = new IdentityAwareProxyOAuthServiceClient(); - - async function callCreateBrand() { - // Construct request - const request = { - parent, - brand, - }; - - // Run request - const response = await iapClient.createBrand(request); - console.log(response); - } - - callCreateBrand(); - // [END iap_v1_generated_IdentityAwareProxyOAuthService_CreateBrand_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.create_identity_aware_proxy_client.js b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.create_identity_aware_proxy_client.js deleted file mode 100644 index b8f1a811679..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.create_identity_aware_proxy_client.js +++ /dev/null @@ -1,69 +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, identityAwareProxyClient) { - // [START iap_v1_generated_IdentityAwareProxyOAuthService_CreateIdentityAwareProxyClient_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Path to create the client in. - * In the following format: - * projects/{project_number/id}/brands/{brand}. - * The project must belong to a G Suite account. - */ - // const parent = 'abc123' - /** - * Required. Identity Aware Proxy Client to be created. - */ - // const identityAwareProxyClient = {} - - // Imports the Iap library - const {IdentityAwareProxyOAuthServiceClient} = require('@google-cloud/iap').v1; - - // Instantiates a client - const iapClient = new IdentityAwareProxyOAuthServiceClient(); - - async function callCreateIdentityAwareProxyClient() { - // Construct request - const request = { - parent, - identityAwareProxyClient, - }; - - // Run request - const response = await iapClient.createIdentityAwareProxyClient(request); - console.log(response); - } - - callCreateIdentityAwareProxyClient(); - // [END iap_v1_generated_IdentityAwareProxyOAuthService_CreateIdentityAwareProxyClient_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.delete_identity_aware_proxy_client.js b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.delete_identity_aware_proxy_client.js deleted file mode 100644 index 986824a094a..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.delete_identity_aware_proxy_client.js +++ /dev/null @@ -1,63 +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 iap_v1_generated_IdentityAwareProxyOAuthService_DeleteIdentityAwareProxyClient_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the Identity Aware Proxy client to be deleted. - * In the following format: - * projects/{project_number/id}/brands/{brand}/identityAwareProxyClients/{client_id}. - */ - // const name = 'abc123' - - // Imports the Iap library - const {IdentityAwareProxyOAuthServiceClient} = require('@google-cloud/iap').v1; - - // Instantiates a client - const iapClient = new IdentityAwareProxyOAuthServiceClient(); - - async function callDeleteIdentityAwareProxyClient() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await iapClient.deleteIdentityAwareProxyClient(request); - console.log(response); - } - - callDeleteIdentityAwareProxyClient(); - // [END iap_v1_generated_IdentityAwareProxyOAuthService_DeleteIdentityAwareProxyClient_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.get_brand.js b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.get_brand.js deleted file mode 100644 index 862cbb4a432..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.get_brand.js +++ /dev/null @@ -1,62 +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 iap_v1_generated_IdentityAwareProxyOAuthService_GetBrand_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the brand to be fetched. - * In the following format: projects/{project_number/id}/brands/{brand}. - */ - // const name = 'abc123' - - // Imports the Iap library - const {IdentityAwareProxyOAuthServiceClient} = require('@google-cloud/iap').v1; - - // Instantiates a client - const iapClient = new IdentityAwareProxyOAuthServiceClient(); - - async function callGetBrand() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await iapClient.getBrand(request); - console.log(response); - } - - callGetBrand(); - // [END iap_v1_generated_IdentityAwareProxyOAuthService_GetBrand_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.get_identity_aware_proxy_client.js b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.get_identity_aware_proxy_client.js deleted file mode 100644 index 1d4272ebf0b..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.get_identity_aware_proxy_client.js +++ /dev/null @@ -1,63 +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 iap_v1_generated_IdentityAwareProxyOAuthService_GetIdentityAwareProxyClient_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the Identity Aware Proxy client to be fetched. - * In the following format: - * projects/{project_number/id}/brands/{brand}/identityAwareProxyClients/{client_id}. - */ - // const name = 'abc123' - - // Imports the Iap library - const {IdentityAwareProxyOAuthServiceClient} = require('@google-cloud/iap').v1; - - // Instantiates a client - const iapClient = new IdentityAwareProxyOAuthServiceClient(); - - async function callGetIdentityAwareProxyClient() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await iapClient.getIdentityAwareProxyClient(request); - console.log(response); - } - - callGetIdentityAwareProxyClient(); - // [END iap_v1_generated_IdentityAwareProxyOAuthService_GetIdentityAwareProxyClient_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.list_brands.js b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.list_brands.js deleted file mode 100644 index bb928480edc..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.list_brands.js +++ /dev/null @@ -1,62 +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 iap_v1_generated_IdentityAwareProxyOAuthService_ListBrands_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. GCP Project number/id. - * In the following format: projects/{project_number/id}. - */ - // const parent = 'abc123' - - // Imports the Iap library - const {IdentityAwareProxyOAuthServiceClient} = require('@google-cloud/iap').v1; - - // Instantiates a client - const iapClient = new IdentityAwareProxyOAuthServiceClient(); - - async function callListBrands() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await iapClient.listBrands(request); - console.log(response); - } - - callListBrands(); - // [END iap_v1_generated_IdentityAwareProxyOAuthService_ListBrands_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.list_identity_aware_proxy_clients.js b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.list_identity_aware_proxy_clients.js deleted file mode 100644 index 327eebde765..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.list_identity_aware_proxy_clients.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(parent) { - // [START iap_v1_generated_IdentityAwareProxyOAuthService_ListIdentityAwareProxyClients_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Full brand path. - * In the following format: projects/{project_number/id}/brands/{brand}. - */ - // const parent = 'abc123' - /** - * The maximum number of clients to return. The service may return fewer than - * this value. - * If unspecified, at most 100 clients will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - */ - // const pageSize = 1234 - /** - * A page token, received from a previous `ListIdentityAwareProxyClients` - * call. Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to - * `ListIdentityAwareProxyClients` must match the call that provided the page - * token. - */ - // const pageToken = 'abc123' - - // Imports the Iap library - const {IdentityAwareProxyOAuthServiceClient} = require('@google-cloud/iap').v1; - - // Instantiates a client - const iapClient = new IdentityAwareProxyOAuthServiceClient(); - - async function callListIdentityAwareProxyClients() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await iapClient.listIdentityAwareProxyClientsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListIdentityAwareProxyClients(); - // [END iap_v1_generated_IdentityAwareProxyOAuthService_ListIdentityAwareProxyClients_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.reset_identity_aware_proxy_client_secret.js b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.reset_identity_aware_proxy_client_secret.js deleted file mode 100644 index 996902dce5f..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_o_auth_service.reset_identity_aware_proxy_client_secret.js +++ /dev/null @@ -1,63 +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 iap_v1_generated_IdentityAwareProxyOAuthService_ResetIdentityAwareProxyClientSecret_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the Identity Aware Proxy client to that will have its - * secret reset. In the following format: - * projects/{project_number/id}/brands/{brand}/identityAwareProxyClients/{client_id}. - */ - // const name = 'abc123' - - // Imports the Iap library - const {IdentityAwareProxyOAuthServiceClient} = require('@google-cloud/iap').v1; - - // Instantiates a client - const iapClient = new IdentityAwareProxyOAuthServiceClient(); - - async function callResetIdentityAwareProxyClientSecret() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await iapClient.resetIdentityAwareProxyClientSecret(request); - console.log(response); - } - - callResetIdentityAwareProxyClientSecret(); - // [END iap_v1_generated_IdentityAwareProxyOAuthService_ResetIdentityAwareProxyClientSecret_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/snippet_metadata.google.cloud.iap.v1.json b/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/snippet_metadata.google.cloud.iap.v1.json deleted file mode 100644 index bbcaf63c5c7..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/snippet_metadata.google.cloud.iap.v1.json +++ /dev/null @@ -1,791 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-iap", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.iap.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "iap_v1_generated_IdentityAwareProxyAdminService_SetIamPolicy_async", - "title": "IdentityAwareProxyAdminService setIamPolicy Sample", - "origin": "API_DEFINITION", - "description": " Sets the access control policy for an Identity-Aware Proxy protected resource. Replaces any existing policy. More information about managing access via IAP can be found at: https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api", - "canonical": true, - "file": "identity_aware_proxy_admin_service.set_iam_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetIamPolicy", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService.SetIamPolicy", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "policy", - "type": ".google.iam.v1.Policy" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.iam.v1.Policy", - "client": { - "shortName": "IdentityAwareProxyAdminServiceClient", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminServiceClient" - }, - "method": { - "shortName": "SetIamPolicy", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService.SetIamPolicy", - "service": { - "shortName": "IdentityAwareProxyAdminService", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService" - } - } - } - }, - { - "regionTag": "iap_v1_generated_IdentityAwareProxyAdminService_GetIamPolicy_async", - "title": "IdentityAwareProxyAdminService getIamPolicy Sample", - "origin": "API_DEFINITION", - "description": " Gets the access control policy for an Identity-Aware Proxy protected resource. More information about managing access via IAP can be found at: https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api", - "canonical": true, - "file": "identity_aware_proxy_admin_service.get_iam_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetIamPolicy", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService.GetIamPolicy", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "options", - "type": ".google.iam.v1.GetPolicyOptions" - } - ], - "resultType": ".google.iam.v1.Policy", - "client": { - "shortName": "IdentityAwareProxyAdminServiceClient", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminServiceClient" - }, - "method": { - "shortName": "GetIamPolicy", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService.GetIamPolicy", - "service": { - "shortName": "IdentityAwareProxyAdminService", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService" - } - } - } - }, - { - "regionTag": "iap_v1_generated_IdentityAwareProxyAdminService_TestIamPermissions_async", - "title": "IdentityAwareProxyAdminService testIamPermissions Sample", - "origin": "API_DEFINITION", - "description": " Returns permissions that a caller has on the Identity-Aware Proxy protected resource. More information about managing access via IAP can be found at: https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api", - "canonical": true, - "file": "identity_aware_proxy_admin_service.test_iam_permissions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "TestIamPermissions", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService.TestIamPermissions", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "permissions", - "type": "TYPE_STRING[]" - } - ], - "resultType": ".google.iam.v1.TestIamPermissionsResponse", - "client": { - "shortName": "IdentityAwareProxyAdminServiceClient", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminServiceClient" - }, - "method": { - "shortName": "TestIamPermissions", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService.TestIamPermissions", - "service": { - "shortName": "IdentityAwareProxyAdminService", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService" - } - } - } - }, - { - "regionTag": "iap_v1_generated_IdentityAwareProxyAdminService_GetIapSettings_async", - "title": "IdentityAwareProxyAdminService getIapSettings Sample", - "origin": "API_DEFINITION", - "description": " Gets the IAP settings on a particular IAP protected resource.", - "canonical": true, - "file": "identity_aware_proxy_admin_service.get_iap_settings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetIapSettings", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService.GetIapSettings", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.iap.v1.IapSettings", - "client": { - "shortName": "IdentityAwareProxyAdminServiceClient", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminServiceClient" - }, - "method": { - "shortName": "GetIapSettings", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService.GetIapSettings", - "service": { - "shortName": "IdentityAwareProxyAdminService", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService" - } - } - } - }, - { - "regionTag": "iap_v1_generated_IdentityAwareProxyAdminService_UpdateIapSettings_async", - "title": "IdentityAwareProxyAdminService updateIapSettings Sample", - "origin": "API_DEFINITION", - "description": " Updates the IAP settings on a particular IAP protected resource. It replaces all fields unless the `update_mask` is set.", - "canonical": true, - "file": "identity_aware_proxy_admin_service.update_iap_settings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateIapSettings", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService.UpdateIapSettings", - "async": true, - "parameters": [ - { - "name": "iap_settings", - "type": ".google.cloud.iap.v1.IapSettings" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.iap.v1.IapSettings", - "client": { - "shortName": "IdentityAwareProxyAdminServiceClient", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminServiceClient" - }, - "method": { - "shortName": "UpdateIapSettings", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService.UpdateIapSettings", - "service": { - "shortName": "IdentityAwareProxyAdminService", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService" - } - } - } - }, - { - "regionTag": "iap_v1_generated_IdentityAwareProxyAdminService_ListTunnelDestGroups_async", - "title": "IdentityAwareProxyAdminService listTunnelDestGroups Sample", - "origin": "API_DEFINITION", - "description": " Lists the existing TunnelDestGroups. To group across all locations, use a `-` as the location ID. For example: `/v1/projects/123/iap_tunnel/locations/-/destGroups`", - "canonical": true, - "file": "identity_aware_proxy_admin_service.list_tunnel_dest_groups.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 73, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListTunnelDestGroups", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService.ListTunnelDestGroups", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.iap.v1.ListTunnelDestGroupsResponse", - "client": { - "shortName": "IdentityAwareProxyAdminServiceClient", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminServiceClient" - }, - "method": { - "shortName": "ListTunnelDestGroups", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService.ListTunnelDestGroups", - "service": { - "shortName": "IdentityAwareProxyAdminService", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService" - } - } - } - }, - { - "regionTag": "iap_v1_generated_IdentityAwareProxyAdminService_CreateTunnelDestGroup_async", - "title": "IdentityAwareProxyAdminService createTunnelDestGroup Sample", - "origin": "API_DEFINITION", - "description": " Creates a new TunnelDestGroup.", - "canonical": true, - "file": "identity_aware_proxy_admin_service.create_tunnel_dest_group.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateTunnelDestGroup", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService.CreateTunnelDestGroup", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "tunnel_dest_group", - "type": ".google.cloud.iap.v1.TunnelDestGroup" - }, - { - "name": "tunnel_dest_group_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.iap.v1.TunnelDestGroup", - "client": { - "shortName": "IdentityAwareProxyAdminServiceClient", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminServiceClient" - }, - "method": { - "shortName": "CreateTunnelDestGroup", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService.CreateTunnelDestGroup", - "service": { - "shortName": "IdentityAwareProxyAdminService", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService" - } - } - } - }, - { - "regionTag": "iap_v1_generated_IdentityAwareProxyAdminService_GetTunnelDestGroup_async", - "title": "IdentityAwareProxyAdminService getTunnelDestGroup Sample", - "origin": "API_DEFINITION", - "description": " Retrieves an existing TunnelDestGroup.", - "canonical": true, - "file": "identity_aware_proxy_admin_service.get_tunnel_dest_group.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetTunnelDestGroup", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService.GetTunnelDestGroup", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.iap.v1.TunnelDestGroup", - "client": { - "shortName": "IdentityAwareProxyAdminServiceClient", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminServiceClient" - }, - "method": { - "shortName": "GetTunnelDestGroup", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService.GetTunnelDestGroup", - "service": { - "shortName": "IdentityAwareProxyAdminService", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService" - } - } - } - }, - { - "regionTag": "iap_v1_generated_IdentityAwareProxyAdminService_DeleteTunnelDestGroup_async", - "title": "IdentityAwareProxyAdminService deleteTunnelDestGroup Sample", - "origin": "API_DEFINITION", - "description": " Deletes a TunnelDestGroup.", - "canonical": true, - "file": "identity_aware_proxy_admin_service.delete_tunnel_dest_group.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteTunnelDestGroup", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService.DeleteTunnelDestGroup", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "IdentityAwareProxyAdminServiceClient", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminServiceClient" - }, - "method": { - "shortName": "DeleteTunnelDestGroup", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService.DeleteTunnelDestGroup", - "service": { - "shortName": "IdentityAwareProxyAdminService", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService" - } - } - } - }, - { - "regionTag": "iap_v1_generated_IdentityAwareProxyAdminService_UpdateTunnelDestGroup_async", - "title": "IdentityAwareProxyAdminService updateTunnelDestGroup Sample", - "origin": "API_DEFINITION", - "description": " Updates a TunnelDestGroup.", - "canonical": true, - "file": "identity_aware_proxy_admin_service.update_tunnel_dest_group.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateTunnelDestGroup", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService.UpdateTunnelDestGroup", - "async": true, - "parameters": [ - { - "name": "tunnel_dest_group", - "type": ".google.cloud.iap.v1.TunnelDestGroup" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.iap.v1.TunnelDestGroup", - "client": { - "shortName": "IdentityAwareProxyAdminServiceClient", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminServiceClient" - }, - "method": { - "shortName": "UpdateTunnelDestGroup", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService.UpdateTunnelDestGroup", - "service": { - "shortName": "IdentityAwareProxyAdminService", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyAdminService" - } - } - } - }, - { - "regionTag": "iap_v1_generated_IdentityAwareProxyOAuthService_ListBrands_async", - "title": "IdentityAwareProxyAdminService listBrands Sample", - "origin": "API_DEFINITION", - "description": " Lists the existing brands for the project.", - "canonical": true, - "file": "identity_aware_proxy_o_auth_service.list_brands.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListBrands", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthService.ListBrands", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.iap.v1.ListBrandsResponse", - "client": { - "shortName": "IdentityAwareProxyOAuthServiceClient", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthServiceClient" - }, - "method": { - "shortName": "ListBrands", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthService.ListBrands", - "service": { - "shortName": "IdentityAwareProxyOAuthService", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthService" - } - } - } - }, - { - "regionTag": "iap_v1_generated_IdentityAwareProxyOAuthService_CreateBrand_async", - "title": "IdentityAwareProxyAdminService createBrand Sample", - "origin": "API_DEFINITION", - "description": " Constructs a new OAuth brand for the project if one does not exist. The created brand is \"internal only\", meaning that OAuth clients created under it only accept requests from users who belong to the same Google Workspace organization as the project. The brand is created in an un-reviewed status. NOTE: The \"internal only\" status can be manually changed in the Google Cloud Console. Requires that a brand does not already exist for the project, and that the specified support email is owned by the caller.", - "canonical": true, - "file": "identity_aware_proxy_o_auth_service.create_brand.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateBrand", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthService.CreateBrand", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "brand", - "type": ".google.cloud.iap.v1.Brand" - } - ], - "resultType": ".google.cloud.iap.v1.Brand", - "client": { - "shortName": "IdentityAwareProxyOAuthServiceClient", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthServiceClient" - }, - "method": { - "shortName": "CreateBrand", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthService.CreateBrand", - "service": { - "shortName": "IdentityAwareProxyOAuthService", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthService" - } - } - } - }, - { - "regionTag": "iap_v1_generated_IdentityAwareProxyOAuthService_GetBrand_async", - "title": "IdentityAwareProxyAdminService getBrand Sample", - "origin": "API_DEFINITION", - "description": " Retrieves the OAuth brand of the project.", - "canonical": true, - "file": "identity_aware_proxy_o_auth_service.get_brand.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetBrand", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthService.GetBrand", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.iap.v1.Brand", - "client": { - "shortName": "IdentityAwareProxyOAuthServiceClient", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthServiceClient" - }, - "method": { - "shortName": "GetBrand", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthService.GetBrand", - "service": { - "shortName": "IdentityAwareProxyOAuthService", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthService" - } - } - } - }, - { - "regionTag": "iap_v1_generated_IdentityAwareProxyOAuthService_CreateIdentityAwareProxyClient_async", - "title": "IdentityAwareProxyAdminService createIdentityAwareProxyClient Sample", - "origin": "API_DEFINITION", - "description": " Creates an Identity Aware Proxy (IAP) OAuth client. The client is owned by IAP. Requires that the brand for the project exists and that it is set for internal-only use.", - "canonical": true, - "file": "identity_aware_proxy_o_auth_service.create_identity_aware_proxy_client.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateIdentityAwareProxyClient", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthService.CreateIdentityAwareProxyClient", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "identity_aware_proxy_client", - "type": ".google.cloud.iap.v1.IdentityAwareProxyClient" - } - ], - "resultType": ".google.cloud.iap.v1.IdentityAwareProxyClient", - "client": { - "shortName": "IdentityAwareProxyOAuthServiceClient", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthServiceClient" - }, - "method": { - "shortName": "CreateIdentityAwareProxyClient", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthService.CreateIdentityAwareProxyClient", - "service": { - "shortName": "IdentityAwareProxyOAuthService", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthService" - } - } - } - }, - { - "regionTag": "iap_v1_generated_IdentityAwareProxyOAuthService_ListIdentityAwareProxyClients_async", - "title": "IdentityAwareProxyAdminService listIdentityAwareProxyClients Sample", - "origin": "API_DEFINITION", - "description": " Lists the existing clients for the brand.", - "canonical": true, - "file": "identity_aware_proxy_o_auth_service.list_identity_aware_proxy_clients.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListIdentityAwareProxyClients", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthService.ListIdentityAwareProxyClients", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.iap.v1.ListIdentityAwareProxyClientsResponse", - "client": { - "shortName": "IdentityAwareProxyOAuthServiceClient", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthServiceClient" - }, - "method": { - "shortName": "ListIdentityAwareProxyClients", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthService.ListIdentityAwareProxyClients", - "service": { - "shortName": "IdentityAwareProxyOAuthService", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthService" - } - } - } - }, - { - "regionTag": "iap_v1_generated_IdentityAwareProxyOAuthService_GetIdentityAwareProxyClient_async", - "title": "IdentityAwareProxyAdminService getIdentityAwareProxyClient Sample", - "origin": "API_DEFINITION", - "description": " Retrieves an Identity Aware Proxy (IAP) OAuth client. Requires that the client is owned by IAP.", - "canonical": true, - "file": "identity_aware_proxy_o_auth_service.get_identity_aware_proxy_client.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetIdentityAwareProxyClient", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthService.GetIdentityAwareProxyClient", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.iap.v1.IdentityAwareProxyClient", - "client": { - "shortName": "IdentityAwareProxyOAuthServiceClient", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthServiceClient" - }, - "method": { - "shortName": "GetIdentityAwareProxyClient", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthService.GetIdentityAwareProxyClient", - "service": { - "shortName": "IdentityAwareProxyOAuthService", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthService" - } - } - } - }, - { - "regionTag": "iap_v1_generated_IdentityAwareProxyOAuthService_ResetIdentityAwareProxyClientSecret_async", - "title": "IdentityAwareProxyAdminService resetIdentityAwareProxyClientSecret Sample", - "origin": "API_DEFINITION", - "description": " Resets an Identity Aware Proxy (IAP) OAuth client secret. Useful if the secret was compromised. Requires that the client is owned by IAP.", - "canonical": true, - "file": "identity_aware_proxy_o_auth_service.reset_identity_aware_proxy_client_secret.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ResetIdentityAwareProxyClientSecret", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthService.ResetIdentityAwareProxyClientSecret", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.iap.v1.IdentityAwareProxyClient", - "client": { - "shortName": "IdentityAwareProxyOAuthServiceClient", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthServiceClient" - }, - "method": { - "shortName": "ResetIdentityAwareProxyClientSecret", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthService.ResetIdentityAwareProxyClientSecret", - "service": { - "shortName": "IdentityAwareProxyOAuthService", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthService" - } - } - } - }, - { - "regionTag": "iap_v1_generated_IdentityAwareProxyOAuthService_DeleteIdentityAwareProxyClient_async", - "title": "IdentityAwareProxyAdminService deleteIdentityAwareProxyClient Sample", - "origin": "API_DEFINITION", - "description": " Deletes an Identity Aware Proxy (IAP) OAuth client. Useful for removing obsolete clients, managing the number of clients in a given project, and cleaning up after tests. Requires that the client is owned by IAP.", - "canonical": true, - "file": "identity_aware_proxy_o_auth_service.delete_identity_aware_proxy_client.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteIdentityAwareProxyClient", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthService.DeleteIdentityAwareProxyClient", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "IdentityAwareProxyOAuthServiceClient", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthServiceClient" - }, - "method": { - "shortName": "DeleteIdentityAwareProxyClient", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthService.DeleteIdentityAwareProxyClient", - "service": { - "shortName": "IdentityAwareProxyOAuthService", - "fullName": "google.cloud.iap.v1.IdentityAwareProxyOAuthService" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-iap/v1/src/index.ts b/owl-bot-staging/google-cloud-iap/v1/src/index.ts deleted file mode 100644 index c888a735188..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1/src/index.ts +++ /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. ** - -import * as v1 from './v1'; -const IdentityAwareProxyAdminServiceClient = v1.IdentityAwareProxyAdminServiceClient; -type IdentityAwareProxyAdminServiceClient = v1.IdentityAwareProxyAdminServiceClient; -const IdentityAwareProxyOAuthServiceClient = v1.IdentityAwareProxyOAuthServiceClient; -type IdentityAwareProxyOAuthServiceClient = v1.IdentityAwareProxyOAuthServiceClient; -export {v1, IdentityAwareProxyAdminServiceClient, IdentityAwareProxyOAuthServiceClient}; -export default {v1, IdentityAwareProxyAdminServiceClient, IdentityAwareProxyOAuthServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-iap/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-iap/v1/src/v1/gapic_metadata.json deleted file mode 100644 index 107c46d00a9..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,225 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.iap.v1", - "libraryPackage": "@google-cloud/iap", - "services": { - "IdentityAwareProxyAdminService": { - "clients": { - "grpc": { - "libraryClient": "IdentityAwareProxyAdminServiceClient", - "rpcs": { - "SetIamPolicy": { - "methods": [ - "setIamPolicy" - ] - }, - "GetIamPolicy": { - "methods": [ - "getIamPolicy" - ] - }, - "TestIamPermissions": { - "methods": [ - "testIamPermissions" - ] - }, - "GetIapSettings": { - "methods": [ - "getIapSettings" - ] - }, - "UpdateIapSettings": { - "methods": [ - "updateIapSettings" - ] - }, - "CreateTunnelDestGroup": { - "methods": [ - "createTunnelDestGroup" - ] - }, - "GetTunnelDestGroup": { - "methods": [ - "getTunnelDestGroup" - ] - }, - "DeleteTunnelDestGroup": { - "methods": [ - "deleteTunnelDestGroup" - ] - }, - "UpdateTunnelDestGroup": { - "methods": [ - "updateTunnelDestGroup" - ] - }, - "ListTunnelDestGroups": { - "methods": [ - "listTunnelDestGroups", - "listTunnelDestGroupsStream", - "listTunnelDestGroupsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "IdentityAwareProxyAdminServiceClient", - "rpcs": { - "SetIamPolicy": { - "methods": [ - "setIamPolicy" - ] - }, - "GetIamPolicy": { - "methods": [ - "getIamPolicy" - ] - }, - "TestIamPermissions": { - "methods": [ - "testIamPermissions" - ] - }, - "GetIapSettings": { - "methods": [ - "getIapSettings" - ] - }, - "UpdateIapSettings": { - "methods": [ - "updateIapSettings" - ] - }, - "CreateTunnelDestGroup": { - "methods": [ - "createTunnelDestGroup" - ] - }, - "GetTunnelDestGroup": { - "methods": [ - "getTunnelDestGroup" - ] - }, - "DeleteTunnelDestGroup": { - "methods": [ - "deleteTunnelDestGroup" - ] - }, - "UpdateTunnelDestGroup": { - "methods": [ - "updateTunnelDestGroup" - ] - }, - "ListTunnelDestGroups": { - "methods": [ - "listTunnelDestGroups", - "listTunnelDestGroupsStream", - "listTunnelDestGroupsAsync" - ] - } - } - } - } - }, - "IdentityAwareProxyOAuthService": { - "clients": { - "grpc": { - "libraryClient": "IdentityAwareProxyOAuthServiceClient", - "rpcs": { - "ListBrands": { - "methods": [ - "listBrands" - ] - }, - "CreateBrand": { - "methods": [ - "createBrand" - ] - }, - "GetBrand": { - "methods": [ - "getBrand" - ] - }, - "CreateIdentityAwareProxyClient": { - "methods": [ - "createIdentityAwareProxyClient" - ] - }, - "GetIdentityAwareProxyClient": { - "methods": [ - "getIdentityAwareProxyClient" - ] - }, - "ResetIdentityAwareProxyClientSecret": { - "methods": [ - "resetIdentityAwareProxyClientSecret" - ] - }, - "DeleteIdentityAwareProxyClient": { - "methods": [ - "deleteIdentityAwareProxyClient" - ] - }, - "ListIdentityAwareProxyClients": { - "methods": [ - "listIdentityAwareProxyClients", - "listIdentityAwareProxyClientsStream", - "listIdentityAwareProxyClientsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "IdentityAwareProxyOAuthServiceClient", - "rpcs": { - "ListBrands": { - "methods": [ - "listBrands" - ] - }, - "CreateBrand": { - "methods": [ - "createBrand" - ] - }, - "GetBrand": { - "methods": [ - "getBrand" - ] - }, - "CreateIdentityAwareProxyClient": { - "methods": [ - "createIdentityAwareProxyClient" - ] - }, - "GetIdentityAwareProxyClient": { - "methods": [ - "getIdentityAwareProxyClient" - ] - }, - "ResetIdentityAwareProxyClientSecret": { - "methods": [ - "resetIdentityAwareProxyClientSecret" - ] - }, - "DeleteIdentityAwareProxyClient": { - "methods": [ - "deleteIdentityAwareProxyClient" - ] - }, - "ListIdentityAwareProxyClients": { - "methods": [ - "listIdentityAwareProxyClients", - "listIdentityAwareProxyClientsStream", - "listIdentityAwareProxyClientsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_admin_service_client.ts b/owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_admin_service_client.ts deleted file mode 100644 index 9814fe9ff11..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_admin_service_client.ts +++ /dev/null @@ -1,1348 +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 type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1/identity_aware_proxy_admin_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './identity_aware_proxy_admin_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * APIs for Identity-Aware Proxy Admin configurations. - * @class - * @memberof v1 - */ -export class IdentityAwareProxyAdminServiceClient { - 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}; - identityAwareProxyAdminServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of IdentityAwareProxyAdminServiceClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new IdentityAwareProxyAdminServiceClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof IdentityAwareProxyAdminServiceClient; - 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); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - tunnelDestGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/iap_tunnel/locations/{location}/destGroups/{dest_group}' - ), - tunnelLocationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/iap_tunnel/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 = { - listTunnelDestGroups: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'tunnelDestGroups') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.iap.v1.IdentityAwareProxyAdminService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.identityAwareProxyAdminServiceStub) { - return this.identityAwareProxyAdminServiceStub; - } - - // Put together the "service stub" for - // google.cloud.iap.v1.IdentityAwareProxyAdminService. - this.identityAwareProxyAdminServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.iap.v1.IdentityAwareProxyAdminService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.iap.v1.IdentityAwareProxyAdminService, - 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 identityAwareProxyAdminServiceStubMethods = - ['setIamPolicy', 'getIamPolicy', 'testIamPermissions', 'getIapSettings', 'updateIapSettings', 'listTunnelDestGroups', 'createTunnelDestGroup', 'getTunnelDestGroup', 'deleteTunnelDestGroup', 'updateTunnelDestGroup']; - for (const methodName of identityAwareProxyAdminServiceStubMethods) { - const callPromise = this.identityAwareProxyAdminServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.identityAwareProxyAdminServiceStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'iap.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 'iap.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 -- - // ------------------- -/** - * Sets the access control policy for an Identity-Aware Proxy protected - * resource. Replaces any existing policy. - * More information about managing access via IAP can be found at: - * https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - * @param {google.iam.v1.Policy} request.policy - * REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - * @param {google.protobuf.FieldMask} request.updateMask - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * - * `paths: "bindings, etag"` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/identity_aware_proxy_admin_service.set_iam_policy.js - * region_tag:iap_v1_generated_IdentityAwareProxyAdminService_SetIamPolicy_async - */ - setIamPolicy( - request?: protos.google.iam.v1.ISetIamPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined - ]>; - setIamPolicy( - request: protos.google.iam.v1.ISetIamPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - setIamPolicy( - request: protos.google.iam.v1.ISetIamPolicyRequest, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - setIamPolicy( - request?: protos.google.iam.v1.ISetIamPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'resource': request.resource ?? '', - }); - this.initialize(); - return this.innerApiCalls.setIamPolicy(request, options, callback); - } -/** - * Gets the access control policy for an Identity-Aware Proxy protected - * resource. - * More information about managing access via IAP can be found at: - * https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {google.iam.v1.GetPolicyOptions} request.options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/identity_aware_proxy_admin_service.get_iam_policy.js - * region_tag:iap_v1_generated_IdentityAwareProxyAdminService_GetIamPolicy_async - */ - getIamPolicy( - request?: protos.google.iam.v1.IGetIamPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined - ]>; - getIamPolicy( - request: protos.google.iam.v1.IGetIamPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - getIamPolicy( - request: protos.google.iam.v1.IGetIamPolicyRequest, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - getIamPolicy( - request?: protos.google.iam.v1.IGetIamPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'resource': request.resource ?? '', - }); - this.initialize(); - return this.innerApiCalls.getIamPolicy(request, options, callback); - } -/** - * Returns permissions that a caller has on the Identity-Aware Proxy protected - * resource. - * More information about managing access via IAP can be found at: - * https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/identity_aware_proxy_admin_service.test_iam_permissions.js - * region_tag:iap_v1_generated_IdentityAwareProxyAdminService_TestIamPermissions_async - */ - testIamPermissions( - request?: protos.google.iam.v1.ITestIamPermissionsRequest, - options?: CallOptions): - Promise<[ - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined - ]>; - testIamPermissions( - request: protos.google.iam.v1.ITestIamPermissionsRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>): void; - testIamPermissions( - request: protos.google.iam.v1.ITestIamPermissionsRequest, - callback: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>): void; - testIamPermissions( - request?: protos.google.iam.v1.ITestIamPermissionsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'resource': request.resource ?? '', - }); - this.initialize(); - return this.innerApiCalls.testIamPermissions(request, options, callback); - } -/** - * Gets the IAP settings on a particular IAP protected resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name for which to retrieve the settings. - * Authorization: Requires the `getSettings` permission for the associated - * resource. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [IapSettings]{@link google.cloud.iap.v1.IapSettings}. - * 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/identity_aware_proxy_admin_service.get_iap_settings.js - * region_tag:iap_v1_generated_IdentityAwareProxyAdminService_GetIapSettings_async - */ - getIapSettings( - request?: protos.google.cloud.iap.v1.IGetIapSettingsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.iap.v1.IIapSettings, - protos.google.cloud.iap.v1.IGetIapSettingsRequest|undefined, {}|undefined - ]>; - getIapSettings( - request: protos.google.cloud.iap.v1.IGetIapSettingsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.iap.v1.IIapSettings, - protos.google.cloud.iap.v1.IGetIapSettingsRequest|null|undefined, - {}|null|undefined>): void; - getIapSettings( - request: protos.google.cloud.iap.v1.IGetIapSettingsRequest, - callback: Callback< - protos.google.cloud.iap.v1.IIapSettings, - protos.google.cloud.iap.v1.IGetIapSettingsRequest|null|undefined, - {}|null|undefined>): void; - getIapSettings( - request?: protos.google.cloud.iap.v1.IGetIapSettingsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.iap.v1.IIapSettings, - protos.google.cloud.iap.v1.IGetIapSettingsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.iap.v1.IIapSettings, - protos.google.cloud.iap.v1.IGetIapSettingsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.iap.v1.IIapSettings, - protos.google.cloud.iap.v1.IGetIapSettingsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getIapSettings(request, options, callback); - } -/** - * Updates the IAP settings on a particular IAP protected resource. It - * replaces all fields unless the `update_mask` is set. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.iap.v1.IapSettings} request.iapSettings - * Required. The new values for the IAP settings to be updated. - * Authorization: Requires the `updateSettings` permission for the associated - * resource. - * @param {google.protobuf.FieldMask} request.updateMask - * The field mask specifying which IAP settings should be updated. - * If omitted, the all of the settings are updated. See - * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [IapSettings]{@link google.cloud.iap.v1.IapSettings}. - * 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/identity_aware_proxy_admin_service.update_iap_settings.js - * region_tag:iap_v1_generated_IdentityAwareProxyAdminService_UpdateIapSettings_async - */ - updateIapSettings( - request?: protos.google.cloud.iap.v1.IUpdateIapSettingsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.iap.v1.IIapSettings, - protos.google.cloud.iap.v1.IUpdateIapSettingsRequest|undefined, {}|undefined - ]>; - updateIapSettings( - request: protos.google.cloud.iap.v1.IUpdateIapSettingsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.iap.v1.IIapSettings, - protos.google.cloud.iap.v1.IUpdateIapSettingsRequest|null|undefined, - {}|null|undefined>): void; - updateIapSettings( - request: protos.google.cloud.iap.v1.IUpdateIapSettingsRequest, - callback: Callback< - protos.google.cloud.iap.v1.IIapSettings, - protos.google.cloud.iap.v1.IUpdateIapSettingsRequest|null|undefined, - {}|null|undefined>): void; - updateIapSettings( - request?: protos.google.cloud.iap.v1.IUpdateIapSettingsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.iap.v1.IIapSettings, - protos.google.cloud.iap.v1.IUpdateIapSettingsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.iap.v1.IIapSettings, - protos.google.cloud.iap.v1.IUpdateIapSettingsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.iap.v1.IIapSettings, - protos.google.cloud.iap.v1.IUpdateIapSettingsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'iap_settings.name': request.iapSettings!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateIapSettings(request, options, callback); - } -/** - * Creates a new TunnelDestGroup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Google Cloud Project ID and location. - * In the following format: - * `projects/{project_number/id}/iap_tunnel/locations/{location}`. - * @param {google.cloud.iap.v1.TunnelDestGroup} request.tunnelDestGroup - * Required. The TunnelDestGroup to create. - * @param {string} request.tunnelDestGroupId - * Required. The ID to use for the TunnelDestGroup, which becomes the final - * component of the resource name. - * - * This value must be 4-63 characters, and valid characters - * are `[a-z]-`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [TunnelDestGroup]{@link google.cloud.iap.v1.TunnelDestGroup}. - * 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/identity_aware_proxy_admin_service.create_tunnel_dest_group.js - * region_tag:iap_v1_generated_IdentityAwareProxyAdminService_CreateTunnelDestGroup_async - */ - createTunnelDestGroup( - request?: protos.google.cloud.iap.v1.ICreateTunnelDestGroupRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.iap.v1.ITunnelDestGroup, - protos.google.cloud.iap.v1.ICreateTunnelDestGroupRequest|undefined, {}|undefined - ]>; - createTunnelDestGroup( - request: protos.google.cloud.iap.v1.ICreateTunnelDestGroupRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.iap.v1.ITunnelDestGroup, - protos.google.cloud.iap.v1.ICreateTunnelDestGroupRequest|null|undefined, - {}|null|undefined>): void; - createTunnelDestGroup( - request: protos.google.cloud.iap.v1.ICreateTunnelDestGroupRequest, - callback: Callback< - protos.google.cloud.iap.v1.ITunnelDestGroup, - protos.google.cloud.iap.v1.ICreateTunnelDestGroupRequest|null|undefined, - {}|null|undefined>): void; - createTunnelDestGroup( - request?: protos.google.cloud.iap.v1.ICreateTunnelDestGroupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.iap.v1.ITunnelDestGroup, - protos.google.cloud.iap.v1.ICreateTunnelDestGroupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.iap.v1.ITunnelDestGroup, - protos.google.cloud.iap.v1.ICreateTunnelDestGroupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.iap.v1.ITunnelDestGroup, - protos.google.cloud.iap.v1.ICreateTunnelDestGroupRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createTunnelDestGroup(request, options, callback); - } -/** - * Retrieves an existing TunnelDestGroup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the TunnelDestGroup to be fetched. - * In the following format: - * `projects/{project_number/id}/iap_tunnel/locations/{location}/destGroups/{dest_group}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [TunnelDestGroup]{@link google.cloud.iap.v1.TunnelDestGroup}. - * 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/identity_aware_proxy_admin_service.get_tunnel_dest_group.js - * region_tag:iap_v1_generated_IdentityAwareProxyAdminService_GetTunnelDestGroup_async - */ - getTunnelDestGroup( - request?: protos.google.cloud.iap.v1.IGetTunnelDestGroupRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.iap.v1.ITunnelDestGroup, - protos.google.cloud.iap.v1.IGetTunnelDestGroupRequest|undefined, {}|undefined - ]>; - getTunnelDestGroup( - request: protos.google.cloud.iap.v1.IGetTunnelDestGroupRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.iap.v1.ITunnelDestGroup, - protos.google.cloud.iap.v1.IGetTunnelDestGroupRequest|null|undefined, - {}|null|undefined>): void; - getTunnelDestGroup( - request: protos.google.cloud.iap.v1.IGetTunnelDestGroupRequest, - callback: Callback< - protos.google.cloud.iap.v1.ITunnelDestGroup, - protos.google.cloud.iap.v1.IGetTunnelDestGroupRequest|null|undefined, - {}|null|undefined>): void; - getTunnelDestGroup( - request?: protos.google.cloud.iap.v1.IGetTunnelDestGroupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.iap.v1.ITunnelDestGroup, - protos.google.cloud.iap.v1.IGetTunnelDestGroupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.iap.v1.ITunnelDestGroup, - protos.google.cloud.iap.v1.IGetTunnelDestGroupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.iap.v1.ITunnelDestGroup, - protos.google.cloud.iap.v1.IGetTunnelDestGroupRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getTunnelDestGroup(request, options, callback); - } -/** - * Deletes a TunnelDestGroup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the TunnelDestGroup to delete. - * In the following format: - * `projects/{project_number/id}/iap_tunnel/locations/{location}/destGroups/{dest_group}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/identity_aware_proxy_admin_service.delete_tunnel_dest_group.js - * region_tag:iap_v1_generated_IdentityAwareProxyAdminService_DeleteTunnelDestGroup_async - */ - deleteTunnelDestGroup( - request?: protos.google.cloud.iap.v1.IDeleteTunnelDestGroupRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.iap.v1.IDeleteTunnelDestGroupRequest|undefined, {}|undefined - ]>; - deleteTunnelDestGroup( - request: protos.google.cloud.iap.v1.IDeleteTunnelDestGroupRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.iap.v1.IDeleteTunnelDestGroupRequest|null|undefined, - {}|null|undefined>): void; - deleteTunnelDestGroup( - request: protos.google.cloud.iap.v1.IDeleteTunnelDestGroupRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.iap.v1.IDeleteTunnelDestGroupRequest|null|undefined, - {}|null|undefined>): void; - deleteTunnelDestGroup( - request?: protos.google.cloud.iap.v1.IDeleteTunnelDestGroupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.iap.v1.IDeleteTunnelDestGroupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.iap.v1.IDeleteTunnelDestGroupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.iap.v1.IDeleteTunnelDestGroupRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteTunnelDestGroup(request, options, callback); - } -/** - * Updates a TunnelDestGroup. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.iap.v1.TunnelDestGroup} request.tunnelDestGroup - * Required. The new values for the TunnelDestGroup. - * @param {google.protobuf.FieldMask} request.updateMask - * A field mask that specifies which IAP settings to update. - * If omitted, then all of the settings are updated. See - * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [TunnelDestGroup]{@link google.cloud.iap.v1.TunnelDestGroup}. - * 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/identity_aware_proxy_admin_service.update_tunnel_dest_group.js - * region_tag:iap_v1_generated_IdentityAwareProxyAdminService_UpdateTunnelDestGroup_async - */ - updateTunnelDestGroup( - request?: protos.google.cloud.iap.v1.IUpdateTunnelDestGroupRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.iap.v1.ITunnelDestGroup, - protos.google.cloud.iap.v1.IUpdateTunnelDestGroupRequest|undefined, {}|undefined - ]>; - updateTunnelDestGroup( - request: protos.google.cloud.iap.v1.IUpdateTunnelDestGroupRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.iap.v1.ITunnelDestGroup, - protos.google.cloud.iap.v1.IUpdateTunnelDestGroupRequest|null|undefined, - {}|null|undefined>): void; - updateTunnelDestGroup( - request: protos.google.cloud.iap.v1.IUpdateTunnelDestGroupRequest, - callback: Callback< - protos.google.cloud.iap.v1.ITunnelDestGroup, - protos.google.cloud.iap.v1.IUpdateTunnelDestGroupRequest|null|undefined, - {}|null|undefined>): void; - updateTunnelDestGroup( - request?: protos.google.cloud.iap.v1.IUpdateTunnelDestGroupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.iap.v1.ITunnelDestGroup, - protos.google.cloud.iap.v1.IUpdateTunnelDestGroupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.iap.v1.ITunnelDestGroup, - protos.google.cloud.iap.v1.IUpdateTunnelDestGroupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.iap.v1.ITunnelDestGroup, - protos.google.cloud.iap.v1.IUpdateTunnelDestGroupRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'tunnel_dest_group.name': request.tunnelDestGroup!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateTunnelDestGroup(request, options, callback); - } - - /** - * Lists the existing TunnelDestGroups. To group across all locations, use a - * `-` as the location ID. For example: - * `/v1/projects/123/iap_tunnel/locations/-/destGroups` - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Google Cloud Project ID and location. - * In the following format: - * `projects/{project_number/id}/iap_tunnel/locations/{location}`. - * A `-` can be used for the location to group across all locations. - * @param {number} request.pageSize - * The maximum number of groups to return. The service might return fewer than - * this value. - * If unspecified, at most 100 groups are returned. - * The maximum value is 1000; values above 1000 are coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListTunnelDestGroups` - * call. Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListTunnelDestGroups` must match the call that provided the page - * token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [TunnelDestGroup]{@link google.cloud.iap.v1.TunnelDestGroup}. - * 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 `listTunnelDestGroupsAsync()` - * 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. - */ - listTunnelDestGroups( - request?: protos.google.cloud.iap.v1.IListTunnelDestGroupsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.iap.v1.ITunnelDestGroup[], - protos.google.cloud.iap.v1.IListTunnelDestGroupsRequest|null, - protos.google.cloud.iap.v1.IListTunnelDestGroupsResponse - ]>; - listTunnelDestGroups( - request: protos.google.cloud.iap.v1.IListTunnelDestGroupsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.iap.v1.IListTunnelDestGroupsRequest, - protos.google.cloud.iap.v1.IListTunnelDestGroupsResponse|null|undefined, - protos.google.cloud.iap.v1.ITunnelDestGroup>): void; - listTunnelDestGroups( - request: protos.google.cloud.iap.v1.IListTunnelDestGroupsRequest, - callback: PaginationCallback< - protos.google.cloud.iap.v1.IListTunnelDestGroupsRequest, - protos.google.cloud.iap.v1.IListTunnelDestGroupsResponse|null|undefined, - protos.google.cloud.iap.v1.ITunnelDestGroup>): void; - listTunnelDestGroups( - request?: protos.google.cloud.iap.v1.IListTunnelDestGroupsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.iap.v1.IListTunnelDestGroupsRequest, - protos.google.cloud.iap.v1.IListTunnelDestGroupsResponse|null|undefined, - protos.google.cloud.iap.v1.ITunnelDestGroup>, - callback?: PaginationCallback< - protos.google.cloud.iap.v1.IListTunnelDestGroupsRequest, - protos.google.cloud.iap.v1.IListTunnelDestGroupsResponse|null|undefined, - protos.google.cloud.iap.v1.ITunnelDestGroup>): - Promise<[ - protos.google.cloud.iap.v1.ITunnelDestGroup[], - protos.google.cloud.iap.v1.IListTunnelDestGroupsRequest|null, - protos.google.cloud.iap.v1.IListTunnelDestGroupsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listTunnelDestGroups(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. Google Cloud Project ID and location. - * In the following format: - * `projects/{project_number/id}/iap_tunnel/locations/{location}`. - * A `-` can be used for the location to group across all locations. - * @param {number} request.pageSize - * The maximum number of groups to return. The service might return fewer than - * this value. - * If unspecified, at most 100 groups are returned. - * The maximum value is 1000; values above 1000 are coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListTunnelDestGroups` - * call. Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListTunnelDestGroups` must match the call that provided the page - * token. - * @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 [TunnelDestGroup]{@link google.cloud.iap.v1.TunnelDestGroup} 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 `listTunnelDestGroupsAsync()` - * 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. - */ - listTunnelDestGroupsStream( - request?: protos.google.cloud.iap.v1.IListTunnelDestGroupsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listTunnelDestGroups']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listTunnelDestGroups.createStream( - this.innerApiCalls.listTunnelDestGroups as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listTunnelDestGroups`, 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. Google Cloud Project ID and location. - * In the following format: - * `projects/{project_number/id}/iap_tunnel/locations/{location}`. - * A `-` can be used for the location to group across all locations. - * @param {number} request.pageSize - * The maximum number of groups to return. The service might return fewer than - * this value. - * If unspecified, at most 100 groups are returned. - * The maximum value is 1000; values above 1000 are coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListTunnelDestGroups` - * call. Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListTunnelDestGroups` must match the call that provided the 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 - * [TunnelDestGroup]{@link google.cloud.iap.v1.TunnelDestGroup}. 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/identity_aware_proxy_admin_service.list_tunnel_dest_groups.js - * region_tag:iap_v1_generated_IdentityAwareProxyAdminService_ListTunnelDestGroups_async - */ - listTunnelDestGroupsAsync( - request?: protos.google.cloud.iap.v1.IListTunnelDestGroupsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listTunnelDestGroups']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listTunnelDestGroups.asyncIterate( - this.innerApiCalls['listTunnelDestGroups'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified tunnelDestGroup resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} dest_group - * @returns {string} Resource name string. - */ - tunnelDestGroupPath(project:string,location:string,destGroup:string) { - return this.pathTemplates.tunnelDestGroupPathTemplate.render({ - project: project, - location: location, - dest_group: destGroup, - }); - } - - /** - * Parse the project from TunnelDestGroup resource. - * - * @param {string} tunnelDestGroupName - * A fully-qualified path representing TunnelDestGroup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromTunnelDestGroupName(tunnelDestGroupName: string) { - return this.pathTemplates.tunnelDestGroupPathTemplate.match(tunnelDestGroupName).project; - } - - /** - * Parse the location from TunnelDestGroup resource. - * - * @param {string} tunnelDestGroupName - * A fully-qualified path representing TunnelDestGroup resource. - * @returns {string} A string representing the location. - */ - matchLocationFromTunnelDestGroupName(tunnelDestGroupName: string) { - return this.pathTemplates.tunnelDestGroupPathTemplate.match(tunnelDestGroupName).location; - } - - /** - * Parse the dest_group from TunnelDestGroup resource. - * - * @param {string} tunnelDestGroupName - * A fully-qualified path representing TunnelDestGroup resource. - * @returns {string} A string representing the dest_group. - */ - matchDestGroupFromTunnelDestGroupName(tunnelDestGroupName: string) { - return this.pathTemplates.tunnelDestGroupPathTemplate.match(tunnelDestGroupName).dest_group; - } - - /** - * Return a fully-qualified tunnelLocation resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - tunnelLocationPath(project:string,location:string) { - return this.pathTemplates.tunnelLocationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from TunnelLocation resource. - * - * @param {string} tunnelLocationName - * A fully-qualified path representing TunnelLocation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromTunnelLocationName(tunnelLocationName: string) { - return this.pathTemplates.tunnelLocationPathTemplate.match(tunnelLocationName).project; - } - - /** - * Parse the location from TunnelLocation resource. - * - * @param {string} tunnelLocationName - * A fully-qualified path representing TunnelLocation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromTunnelLocationName(tunnelLocationName: string) { - return this.pathTemplates.tunnelLocationPathTemplate.match(tunnelLocationName).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.identityAwareProxyAdminServiceStub && !this._terminated) { - return this.identityAwareProxyAdminServiceStub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_admin_service_client_config.json b/owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_admin_service_client_config.json deleted file mode 100644 index f1329e129a4..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_admin_service_client_config.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "interfaces": { - "google.cloud.iap.v1.IdentityAwareProxyAdminService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "SetIamPolicy": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetIamPolicy": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "TestIamPermissions": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetIapSettings": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateIapSettings": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListTunnelDestGroups": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateTunnelDestGroup": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetTunnelDestGroup": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteTunnelDestGroup": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateTunnelDestGroup": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_admin_service_proto_list.json b/owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_admin_service_proto_list.json deleted file mode 100644 index 54bf0f1d880..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_admin_service_proto_list.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/cloud/iap/v1/service.proto" -] diff --git a/owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_o_auth_service_client.ts b/owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_o_auth_service_client.ts deleted file mode 100644 index 0a81839a3f0..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_o_auth_service_client.ts +++ /dev/null @@ -1,1171 +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 type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1/identity_aware_proxy_o_auth_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './identity_aware_proxy_o_auth_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * API to programmatically create, list and retrieve Identity Aware Proxy (IAP) - * OAuth brands; and create, retrieve, delete and reset-secret of IAP OAuth - * clients. - * @class - * @memberof v1 - */ -export class IdentityAwareProxyOAuthServiceClient { - 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}; - identityAwareProxyOAuthServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of IdentityAwareProxyOAuthServiceClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new IdentityAwareProxyOAuthServiceClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof IdentityAwareProxyOAuthServiceClient; - 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); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - tunnelDestGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/iap_tunnel/locations/{location}/destGroups/{dest_group}' - ), - tunnelLocationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/iap_tunnel/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 = { - listIdentityAwareProxyClients: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'identityAwareProxyClients') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.iap.v1.IdentityAwareProxyOAuthService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.identityAwareProxyOAuthServiceStub) { - return this.identityAwareProxyOAuthServiceStub; - } - - // Put together the "service stub" for - // google.cloud.iap.v1.IdentityAwareProxyOAuthService. - this.identityAwareProxyOAuthServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.iap.v1.IdentityAwareProxyOAuthService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.iap.v1.IdentityAwareProxyOAuthService, - 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 identityAwareProxyOAuthServiceStubMethods = - ['listBrands', 'createBrand', 'getBrand', 'createIdentityAwareProxyClient', 'listIdentityAwareProxyClients', 'getIdentityAwareProxyClient', 'resetIdentityAwareProxyClientSecret', 'deleteIdentityAwareProxyClient']; - for (const methodName of identityAwareProxyOAuthServiceStubMethods) { - const callPromise = this.identityAwareProxyOAuthServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.identityAwareProxyOAuthServiceStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'iap.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 'iap.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 -- - // ------------------- -/** - * Lists the existing brands for the project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. GCP Project number/id. - * In the following format: projects/{project_number/id}. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ListBrandsResponse]{@link google.cloud.iap.v1.ListBrandsResponse}. - * 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/identity_aware_proxy_o_auth_service.list_brands.js - * region_tag:iap_v1_generated_IdentityAwareProxyOAuthService_ListBrands_async - */ - listBrands( - request?: protos.google.cloud.iap.v1.IListBrandsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.iap.v1.IListBrandsResponse, - protos.google.cloud.iap.v1.IListBrandsRequest|undefined, {}|undefined - ]>; - listBrands( - request: protos.google.cloud.iap.v1.IListBrandsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.iap.v1.IListBrandsResponse, - protos.google.cloud.iap.v1.IListBrandsRequest|null|undefined, - {}|null|undefined>): void; - listBrands( - request: protos.google.cloud.iap.v1.IListBrandsRequest, - callback: Callback< - protos.google.cloud.iap.v1.IListBrandsResponse, - protos.google.cloud.iap.v1.IListBrandsRequest|null|undefined, - {}|null|undefined>): void; - listBrands( - request?: protos.google.cloud.iap.v1.IListBrandsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.iap.v1.IListBrandsResponse, - protos.google.cloud.iap.v1.IListBrandsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.iap.v1.IListBrandsResponse, - protos.google.cloud.iap.v1.IListBrandsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.iap.v1.IListBrandsResponse, - protos.google.cloud.iap.v1.IListBrandsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listBrands(request, options, callback); - } -/** - * Constructs a new OAuth brand for the project if one does not exist. - * The created brand is "internal only", meaning that OAuth clients created - * under it only accept requests from users who belong to the same Google - * Workspace organization as the project. The brand is created in an - * un-reviewed status. NOTE: The "internal only" status can be manually - * changed in the Google Cloud Console. Requires that a brand does not already - * exist for the project, and that the specified support email is owned by the - * caller. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. GCP Project number/id under which the brand is to be created. - * In the following format: projects/{project_number/id}. - * @param {google.cloud.iap.v1.Brand} request.brand - * Required. The brand to be created. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Brand]{@link google.cloud.iap.v1.Brand}. - * 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/identity_aware_proxy_o_auth_service.create_brand.js - * region_tag:iap_v1_generated_IdentityAwareProxyOAuthService_CreateBrand_async - */ - createBrand( - request?: protos.google.cloud.iap.v1.ICreateBrandRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.iap.v1.IBrand, - protos.google.cloud.iap.v1.ICreateBrandRequest|undefined, {}|undefined - ]>; - createBrand( - request: protos.google.cloud.iap.v1.ICreateBrandRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.iap.v1.IBrand, - protos.google.cloud.iap.v1.ICreateBrandRequest|null|undefined, - {}|null|undefined>): void; - createBrand( - request: protos.google.cloud.iap.v1.ICreateBrandRequest, - callback: Callback< - protos.google.cloud.iap.v1.IBrand, - protos.google.cloud.iap.v1.ICreateBrandRequest|null|undefined, - {}|null|undefined>): void; - createBrand( - request?: protos.google.cloud.iap.v1.ICreateBrandRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.iap.v1.IBrand, - protos.google.cloud.iap.v1.ICreateBrandRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.iap.v1.IBrand, - protos.google.cloud.iap.v1.ICreateBrandRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.iap.v1.IBrand, - protos.google.cloud.iap.v1.ICreateBrandRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createBrand(request, options, callback); - } -/** - * Retrieves the OAuth brand of the project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the brand to be fetched. - * In the following format: projects/{project_number/id}/brands/{brand}. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [Brand]{@link google.cloud.iap.v1.Brand}. - * 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/identity_aware_proxy_o_auth_service.get_brand.js - * region_tag:iap_v1_generated_IdentityAwareProxyOAuthService_GetBrand_async - */ - getBrand( - request?: protos.google.cloud.iap.v1.IGetBrandRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.iap.v1.IBrand, - protos.google.cloud.iap.v1.IGetBrandRequest|undefined, {}|undefined - ]>; - getBrand( - request: protos.google.cloud.iap.v1.IGetBrandRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.iap.v1.IBrand, - protos.google.cloud.iap.v1.IGetBrandRequest|null|undefined, - {}|null|undefined>): void; - getBrand( - request: protos.google.cloud.iap.v1.IGetBrandRequest, - callback: Callback< - protos.google.cloud.iap.v1.IBrand, - protos.google.cloud.iap.v1.IGetBrandRequest|null|undefined, - {}|null|undefined>): void; - getBrand( - request?: protos.google.cloud.iap.v1.IGetBrandRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.iap.v1.IBrand, - protos.google.cloud.iap.v1.IGetBrandRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.iap.v1.IBrand, - protos.google.cloud.iap.v1.IGetBrandRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.iap.v1.IBrand, - protos.google.cloud.iap.v1.IGetBrandRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getBrand(request, options, callback); - } -/** - * Creates an Identity Aware Proxy (IAP) OAuth client. The client is owned - * by IAP. Requires that the brand for the project exists and that it is - * set for internal-only use. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Path to create the client in. - * In the following format: - * projects/{project_number/id}/brands/{brand}. - * The project must belong to a G Suite account. - * @param {google.cloud.iap.v1.IdentityAwareProxyClient} request.identityAwareProxyClient - * Required. Identity Aware Proxy Client to be created. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [IdentityAwareProxyClient]{@link google.cloud.iap.v1.IdentityAwareProxyClient}. - * 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/identity_aware_proxy_o_auth_service.create_identity_aware_proxy_client.js - * region_tag:iap_v1_generated_IdentityAwareProxyOAuthService_CreateIdentityAwareProxyClient_async - */ - createIdentityAwareProxyClient( - request?: protos.google.cloud.iap.v1.ICreateIdentityAwareProxyClientRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.iap.v1.IIdentityAwareProxyClient, - protos.google.cloud.iap.v1.ICreateIdentityAwareProxyClientRequest|undefined, {}|undefined - ]>; - createIdentityAwareProxyClient( - request: protos.google.cloud.iap.v1.ICreateIdentityAwareProxyClientRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.iap.v1.IIdentityAwareProxyClient, - protos.google.cloud.iap.v1.ICreateIdentityAwareProxyClientRequest|null|undefined, - {}|null|undefined>): void; - createIdentityAwareProxyClient( - request: protos.google.cloud.iap.v1.ICreateIdentityAwareProxyClientRequest, - callback: Callback< - protos.google.cloud.iap.v1.IIdentityAwareProxyClient, - protos.google.cloud.iap.v1.ICreateIdentityAwareProxyClientRequest|null|undefined, - {}|null|undefined>): void; - createIdentityAwareProxyClient( - request?: protos.google.cloud.iap.v1.ICreateIdentityAwareProxyClientRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.iap.v1.IIdentityAwareProxyClient, - protos.google.cloud.iap.v1.ICreateIdentityAwareProxyClientRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.iap.v1.IIdentityAwareProxyClient, - protos.google.cloud.iap.v1.ICreateIdentityAwareProxyClientRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.iap.v1.IIdentityAwareProxyClient, - protos.google.cloud.iap.v1.ICreateIdentityAwareProxyClientRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createIdentityAwareProxyClient(request, options, callback); - } -/** - * Retrieves an Identity Aware Proxy (IAP) OAuth client. - * Requires that the client is owned by IAP. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the Identity Aware Proxy client to be fetched. - * In the following format: - * projects/{project_number/id}/brands/{brand}/identityAwareProxyClients/{client_id}. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [IdentityAwareProxyClient]{@link google.cloud.iap.v1.IdentityAwareProxyClient}. - * 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/identity_aware_proxy_o_auth_service.get_identity_aware_proxy_client.js - * region_tag:iap_v1_generated_IdentityAwareProxyOAuthService_GetIdentityAwareProxyClient_async - */ - getIdentityAwareProxyClient( - request?: protos.google.cloud.iap.v1.IGetIdentityAwareProxyClientRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.iap.v1.IIdentityAwareProxyClient, - protos.google.cloud.iap.v1.IGetIdentityAwareProxyClientRequest|undefined, {}|undefined - ]>; - getIdentityAwareProxyClient( - request: protos.google.cloud.iap.v1.IGetIdentityAwareProxyClientRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.iap.v1.IIdentityAwareProxyClient, - protos.google.cloud.iap.v1.IGetIdentityAwareProxyClientRequest|null|undefined, - {}|null|undefined>): void; - getIdentityAwareProxyClient( - request: protos.google.cloud.iap.v1.IGetIdentityAwareProxyClientRequest, - callback: Callback< - protos.google.cloud.iap.v1.IIdentityAwareProxyClient, - protos.google.cloud.iap.v1.IGetIdentityAwareProxyClientRequest|null|undefined, - {}|null|undefined>): void; - getIdentityAwareProxyClient( - request?: protos.google.cloud.iap.v1.IGetIdentityAwareProxyClientRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.iap.v1.IIdentityAwareProxyClient, - protos.google.cloud.iap.v1.IGetIdentityAwareProxyClientRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.iap.v1.IIdentityAwareProxyClient, - protos.google.cloud.iap.v1.IGetIdentityAwareProxyClientRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.iap.v1.IIdentityAwareProxyClient, - protos.google.cloud.iap.v1.IGetIdentityAwareProxyClientRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getIdentityAwareProxyClient(request, options, callback); - } -/** - * Resets an Identity Aware Proxy (IAP) OAuth client secret. Useful if the - * secret was compromised. Requires that the client is owned by IAP. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the Identity Aware Proxy client to that will have its - * secret reset. In the following format: - * projects/{project_number/id}/brands/{brand}/identityAwareProxyClients/{client_id}. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [IdentityAwareProxyClient]{@link google.cloud.iap.v1.IdentityAwareProxyClient}. - * 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/identity_aware_proxy_o_auth_service.reset_identity_aware_proxy_client_secret.js - * region_tag:iap_v1_generated_IdentityAwareProxyOAuthService_ResetIdentityAwareProxyClientSecret_async - */ - resetIdentityAwareProxyClientSecret( - request?: protos.google.cloud.iap.v1.IResetIdentityAwareProxyClientSecretRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.iap.v1.IIdentityAwareProxyClient, - protos.google.cloud.iap.v1.IResetIdentityAwareProxyClientSecretRequest|undefined, {}|undefined - ]>; - resetIdentityAwareProxyClientSecret( - request: protos.google.cloud.iap.v1.IResetIdentityAwareProxyClientSecretRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.iap.v1.IIdentityAwareProxyClient, - protos.google.cloud.iap.v1.IResetIdentityAwareProxyClientSecretRequest|null|undefined, - {}|null|undefined>): void; - resetIdentityAwareProxyClientSecret( - request: protos.google.cloud.iap.v1.IResetIdentityAwareProxyClientSecretRequest, - callback: Callback< - protos.google.cloud.iap.v1.IIdentityAwareProxyClient, - protos.google.cloud.iap.v1.IResetIdentityAwareProxyClientSecretRequest|null|undefined, - {}|null|undefined>): void; - resetIdentityAwareProxyClientSecret( - request?: protos.google.cloud.iap.v1.IResetIdentityAwareProxyClientSecretRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.iap.v1.IIdentityAwareProxyClient, - protos.google.cloud.iap.v1.IResetIdentityAwareProxyClientSecretRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.iap.v1.IIdentityAwareProxyClient, - protos.google.cloud.iap.v1.IResetIdentityAwareProxyClientSecretRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.iap.v1.IIdentityAwareProxyClient, - protos.google.cloud.iap.v1.IResetIdentityAwareProxyClientSecretRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.resetIdentityAwareProxyClientSecret(request, options, callback); - } -/** - * Deletes an Identity Aware Proxy (IAP) OAuth client. Useful for removing - * obsolete clients, managing the number of clients in a given project, and - * cleaning up after tests. Requires that the client is owned by IAP. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the Identity Aware Proxy client to be deleted. - * In the following format: - * projects/{project_number/id}/brands/{brand}/identityAwareProxyClients/{client_id}. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/identity_aware_proxy_o_auth_service.delete_identity_aware_proxy_client.js - * region_tag:iap_v1_generated_IdentityAwareProxyOAuthService_DeleteIdentityAwareProxyClient_async - */ - deleteIdentityAwareProxyClient( - request?: protos.google.cloud.iap.v1.IDeleteIdentityAwareProxyClientRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.iap.v1.IDeleteIdentityAwareProxyClientRequest|undefined, {}|undefined - ]>; - deleteIdentityAwareProxyClient( - request: protos.google.cloud.iap.v1.IDeleteIdentityAwareProxyClientRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.iap.v1.IDeleteIdentityAwareProxyClientRequest|null|undefined, - {}|null|undefined>): void; - deleteIdentityAwareProxyClient( - request: protos.google.cloud.iap.v1.IDeleteIdentityAwareProxyClientRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.iap.v1.IDeleteIdentityAwareProxyClientRequest|null|undefined, - {}|null|undefined>): void; - deleteIdentityAwareProxyClient( - request?: protos.google.cloud.iap.v1.IDeleteIdentityAwareProxyClientRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.iap.v1.IDeleteIdentityAwareProxyClientRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.iap.v1.IDeleteIdentityAwareProxyClientRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.iap.v1.IDeleteIdentityAwareProxyClientRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteIdentityAwareProxyClient(request, options, callback); - } - - /** - * Lists the existing clients for the brand. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Full brand path. - * In the following format: projects/{project_number/id}/brands/{brand}. - * @param {number} request.pageSize - * The maximum number of clients to return. The service may return fewer than - * this value. - * If unspecified, at most 100 clients will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListIdentityAwareProxyClients` - * call. Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListIdentityAwareProxyClients` must match the call that provided the page - * token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [IdentityAwareProxyClient]{@link google.cloud.iap.v1.IdentityAwareProxyClient}. - * 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 `listIdentityAwareProxyClientsAsync()` - * 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. - */ - listIdentityAwareProxyClients( - request?: protos.google.cloud.iap.v1.IListIdentityAwareProxyClientsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.iap.v1.IIdentityAwareProxyClient[], - protos.google.cloud.iap.v1.IListIdentityAwareProxyClientsRequest|null, - protos.google.cloud.iap.v1.IListIdentityAwareProxyClientsResponse - ]>; - listIdentityAwareProxyClients( - request: protos.google.cloud.iap.v1.IListIdentityAwareProxyClientsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.iap.v1.IListIdentityAwareProxyClientsRequest, - protos.google.cloud.iap.v1.IListIdentityAwareProxyClientsResponse|null|undefined, - protos.google.cloud.iap.v1.IIdentityAwareProxyClient>): void; - listIdentityAwareProxyClients( - request: protos.google.cloud.iap.v1.IListIdentityAwareProxyClientsRequest, - callback: PaginationCallback< - protos.google.cloud.iap.v1.IListIdentityAwareProxyClientsRequest, - protos.google.cloud.iap.v1.IListIdentityAwareProxyClientsResponse|null|undefined, - protos.google.cloud.iap.v1.IIdentityAwareProxyClient>): void; - listIdentityAwareProxyClients( - request?: protos.google.cloud.iap.v1.IListIdentityAwareProxyClientsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.iap.v1.IListIdentityAwareProxyClientsRequest, - protos.google.cloud.iap.v1.IListIdentityAwareProxyClientsResponse|null|undefined, - protos.google.cloud.iap.v1.IIdentityAwareProxyClient>, - callback?: PaginationCallback< - protos.google.cloud.iap.v1.IListIdentityAwareProxyClientsRequest, - protos.google.cloud.iap.v1.IListIdentityAwareProxyClientsResponse|null|undefined, - protos.google.cloud.iap.v1.IIdentityAwareProxyClient>): - Promise<[ - protos.google.cloud.iap.v1.IIdentityAwareProxyClient[], - protos.google.cloud.iap.v1.IListIdentityAwareProxyClientsRequest|null, - protos.google.cloud.iap.v1.IListIdentityAwareProxyClientsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listIdentityAwareProxyClients(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. Full brand path. - * In the following format: projects/{project_number/id}/brands/{brand}. - * @param {number} request.pageSize - * The maximum number of clients to return. The service may return fewer than - * this value. - * If unspecified, at most 100 clients will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListIdentityAwareProxyClients` - * call. Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListIdentityAwareProxyClients` must match the call that provided the page - * token. - * @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 [IdentityAwareProxyClient]{@link google.cloud.iap.v1.IdentityAwareProxyClient} 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 `listIdentityAwareProxyClientsAsync()` - * 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. - */ - listIdentityAwareProxyClientsStream( - request?: protos.google.cloud.iap.v1.IListIdentityAwareProxyClientsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listIdentityAwareProxyClients']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listIdentityAwareProxyClients.createStream( - this.innerApiCalls.listIdentityAwareProxyClients as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listIdentityAwareProxyClients`, 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. Full brand path. - * In the following format: projects/{project_number/id}/brands/{brand}. - * @param {number} request.pageSize - * The maximum number of clients to return. The service may return fewer than - * this value. - * If unspecified, at most 100 clients will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListIdentityAwareProxyClients` - * call. Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListIdentityAwareProxyClients` must match the call that provided the 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 - * [IdentityAwareProxyClient]{@link google.cloud.iap.v1.IdentityAwareProxyClient}. 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/identity_aware_proxy_o_auth_service.list_identity_aware_proxy_clients.js - * region_tag:iap_v1_generated_IdentityAwareProxyOAuthService_ListIdentityAwareProxyClients_async - */ - listIdentityAwareProxyClientsAsync( - request?: protos.google.cloud.iap.v1.IListIdentityAwareProxyClientsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listIdentityAwareProxyClients']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listIdentityAwareProxyClients.asyncIterate( - this.innerApiCalls['listIdentityAwareProxyClients'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified tunnelDestGroup resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} dest_group - * @returns {string} Resource name string. - */ - tunnelDestGroupPath(project:string,location:string,destGroup:string) { - return this.pathTemplates.tunnelDestGroupPathTemplate.render({ - project: project, - location: location, - dest_group: destGroup, - }); - } - - /** - * Parse the project from TunnelDestGroup resource. - * - * @param {string} tunnelDestGroupName - * A fully-qualified path representing TunnelDestGroup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromTunnelDestGroupName(tunnelDestGroupName: string) { - return this.pathTemplates.tunnelDestGroupPathTemplate.match(tunnelDestGroupName).project; - } - - /** - * Parse the location from TunnelDestGroup resource. - * - * @param {string} tunnelDestGroupName - * A fully-qualified path representing TunnelDestGroup resource. - * @returns {string} A string representing the location. - */ - matchLocationFromTunnelDestGroupName(tunnelDestGroupName: string) { - return this.pathTemplates.tunnelDestGroupPathTemplate.match(tunnelDestGroupName).location; - } - - /** - * Parse the dest_group from TunnelDestGroup resource. - * - * @param {string} tunnelDestGroupName - * A fully-qualified path representing TunnelDestGroup resource. - * @returns {string} A string representing the dest_group. - */ - matchDestGroupFromTunnelDestGroupName(tunnelDestGroupName: string) { - return this.pathTemplates.tunnelDestGroupPathTemplate.match(tunnelDestGroupName).dest_group; - } - - /** - * Return a fully-qualified tunnelLocation resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - tunnelLocationPath(project:string,location:string) { - return this.pathTemplates.tunnelLocationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from TunnelLocation resource. - * - * @param {string} tunnelLocationName - * A fully-qualified path representing TunnelLocation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromTunnelLocationName(tunnelLocationName: string) { - return this.pathTemplates.tunnelLocationPathTemplate.match(tunnelLocationName).project; - } - - /** - * Parse the location from TunnelLocation resource. - * - * @param {string} tunnelLocationName - * A fully-qualified path representing TunnelLocation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromTunnelLocationName(tunnelLocationName: string) { - return this.pathTemplates.tunnelLocationPathTemplate.match(tunnelLocationName).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.identityAwareProxyOAuthServiceStub && !this._terminated) { - return this.identityAwareProxyOAuthServiceStub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_o_auth_service_client_config.json b/owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_o_auth_service_client_config.json deleted file mode 100644 index 03031e43136..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_o_auth_service_client_config.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "interfaces": { - "google.cloud.iap.v1.IdentityAwareProxyOAuthService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListBrands": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateBrand": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetBrand": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateIdentityAwareProxyClient": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListIdentityAwareProxyClients": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetIdentityAwareProxyClient": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ResetIdentityAwareProxyClientSecret": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteIdentityAwareProxyClient": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_o_auth_service_proto_list.json b/owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_o_auth_service_proto_list.json deleted file mode 100644 index 54bf0f1d880..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_o_auth_service_proto_list.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/cloud/iap/v1/service.proto" -] diff --git a/owl-bot-staging/google-cloud-iap/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-iap/v1/src/v1/index.ts deleted file mode 100644 index 11b86574434..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1/src/v1/index.ts +++ /dev/null @@ -1,20 +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 {IdentityAwareProxyAdminServiceClient} from './identity_aware_proxy_admin_service_client'; -export {IdentityAwareProxyOAuthServiceClient} from './identity_aware_proxy_o_auth_service_client'; diff --git a/owl-bot-staging/google-cloud-iap/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-iap/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 1a23a4844e2..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,28 +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 iap = require('@google-cloud/iap'); - -function main() { - const identityAwareProxyAdminServiceClient = new iap.IdentityAwareProxyAdminServiceClient(); - const identityAwareProxyOAuthServiceClient = new iap.IdentityAwareProxyOAuthServiceClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-iap/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-iap/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index b7a0f612aca..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,38 +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 {IdentityAwareProxyAdminServiceClient, IdentityAwareProxyOAuthServiceClient} from '@google-cloud/iap'; - -// check that the client class type name can be used -function doStuffWithIdentityAwareProxyAdminServiceClient(client: IdentityAwareProxyAdminServiceClient) { - client.close(); -} -function doStuffWithIdentityAwareProxyOAuthServiceClient(client: IdentityAwareProxyOAuthServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const identityAwareProxyAdminServiceClient = new IdentityAwareProxyAdminServiceClient(); - doStuffWithIdentityAwareProxyAdminServiceClient(identityAwareProxyAdminServiceClient); - // check that the client instance can be created - const identityAwareProxyOAuthServiceClient = new IdentityAwareProxyOAuthServiceClient(); - doStuffWithIdentityAwareProxyOAuthServiceClient(identityAwareProxyOAuthServiceClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-iap/v1/system-test/install.ts b/owl-bot-staging/google-cloud-iap/v1/system-test/install.ts deleted file mode 100644 index 557a57558e1..00000000000 --- a/owl-bot-staging/google-cloud-iap/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/google-cloud-iap/v1/test/gapic_identity_aware_proxy_admin_service_v1.ts b/owl-bot-staging/google-cloud-iap/v1/test/gapic_identity_aware_proxy_admin_service_v1.ts deleted file mode 100644 index c3cb7908ccd..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1/test/gapic_identity_aware_proxy_admin_service_v1.ts +++ /dev/null @@ -1,1539 +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 identityawareproxyadminserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.IdentityAwareProxyAdminServiceClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.identityAwareProxyAdminServiceStub, undefined); - await client.initialize(); - assert(client.identityAwareProxyAdminServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.identityAwareProxyAdminServiceStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.identityAwareProxyAdminServiceStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ - 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 identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ - 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('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.SetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.SetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.Policy() - ); - client.innerApiCalls.setIamPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.setIamPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setIamPolicy without error using callback', async () => { - const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.SetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.SetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.Policy() - ); - client.innerApiCalls.setIamPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setIamPolicy with error', async () => { - const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.SetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.SetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setIamPolicy with closed client', async () => { - const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.SetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.SetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.setIamPolicy(request), expectedError); - }); - }); - - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.GetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.Policy() - ); - client.innerApiCalls.getIamPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.getIamPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getIamPolicy without error using callback', async () => { - const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.GetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.Policy() - ); - client.innerApiCalls.getIamPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getIamPolicy with error', async () => { - const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.GetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getIamPolicy with closed client', async () => { - const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.GetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getIamPolicy(request), expectedError); - }); - }); - - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.TestIamPermissionsRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsResponse() - ); - client.innerApiCalls.testIamPermissions = stubSimpleCall(expectedResponse); - const [response] = await client.testIamPermissions(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes testIamPermissions without error using callback', async () => { - const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.TestIamPermissionsRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsResponse() - ); - client.innerApiCalls.testIamPermissions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - (err?: Error|null, result?: protos.google.iam.v1.ITestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes testIamPermissions with error', async () => { - const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.TestIamPermissionsRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request), expectedError); - const actualRequest = (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes testIamPermissions with closed client', async () => { - const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.TestIamPermissionsRequest', ['resource']); - request.resource = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.testIamPermissions(request), expectedError); - }); - }); - - describe('getIapSettings', () => { - it('invokes getIapSettings without error', async () => { - const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.GetIapSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.GetIapSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.iap.v1.IapSettings() - ); - client.innerApiCalls.getIapSettings = stubSimpleCall(expectedResponse); - const [response] = await client.getIapSettings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getIapSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getIapSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getIapSettings without error using callback', async () => { - const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.GetIapSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.GetIapSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.iap.v1.IapSettings() - ); - client.innerApiCalls.getIapSettings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIapSettings( - request, - (err?: Error|null, result?: protos.google.cloud.iap.v1.IIapSettings|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getIapSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getIapSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getIapSettings with error', async () => { - const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.GetIapSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.GetIapSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getIapSettings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIapSettings(request), expectedError); - const actualRequest = (client.innerApiCalls.getIapSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getIapSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getIapSettings with closed client', async () => { - const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.GetIapSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.GetIapSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getIapSettings(request), expectedError); - }); - }); - - describe('updateIapSettings', () => { - it('invokes updateIapSettings without error', async () => { - const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.UpdateIapSettingsRequest() - ); - request.iapSettings ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.UpdateIapSettingsRequest', ['iapSettings', 'name']); - request.iapSettings.name = defaultValue1; - const expectedHeaderRequestParams = `iap_settings.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.iap.v1.IapSettings() - ); - client.innerApiCalls.updateIapSettings = stubSimpleCall(expectedResponse); - const [response] = await client.updateIapSettings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateIapSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateIapSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateIapSettings without error using callback', async () => { - const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.UpdateIapSettingsRequest() - ); - request.iapSettings ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.UpdateIapSettingsRequest', ['iapSettings', 'name']); - request.iapSettings.name = defaultValue1; - const expectedHeaderRequestParams = `iap_settings.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.iap.v1.IapSettings() - ); - client.innerApiCalls.updateIapSettings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateIapSettings( - request, - (err?: Error|null, result?: protos.google.cloud.iap.v1.IIapSettings|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateIapSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateIapSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateIapSettings with error', async () => { - const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.UpdateIapSettingsRequest() - ); - request.iapSettings ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.UpdateIapSettingsRequest', ['iapSettings', 'name']); - request.iapSettings.name = defaultValue1; - const expectedHeaderRequestParams = `iap_settings.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateIapSettings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateIapSettings(request), expectedError); - const actualRequest = (client.innerApiCalls.updateIapSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateIapSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateIapSettings with closed client', async () => { - const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.UpdateIapSettingsRequest() - ); - request.iapSettings ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.UpdateIapSettingsRequest', ['iapSettings', 'name']); - request.iapSettings.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateIapSettings(request), expectedError); - }); - }); - - describe('createTunnelDestGroup', () => { - it('invokes createTunnelDestGroup without error', async () => { - const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.CreateTunnelDestGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.CreateTunnelDestGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.iap.v1.TunnelDestGroup() - ); - client.innerApiCalls.createTunnelDestGroup = stubSimpleCall(expectedResponse); - const [response] = await client.createTunnelDestGroup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createTunnelDestGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createTunnelDestGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createTunnelDestGroup without error using callback', async () => { - const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.CreateTunnelDestGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.CreateTunnelDestGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.iap.v1.TunnelDestGroup() - ); - client.innerApiCalls.createTunnelDestGroup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createTunnelDestGroup( - request, - (err?: Error|null, result?: protos.google.cloud.iap.v1.ITunnelDestGroup|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createTunnelDestGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createTunnelDestGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createTunnelDestGroup with error', async () => { - const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.CreateTunnelDestGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.CreateTunnelDestGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createTunnelDestGroup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createTunnelDestGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.createTunnelDestGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createTunnelDestGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createTunnelDestGroup with closed client', async () => { - const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.CreateTunnelDestGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.CreateTunnelDestGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createTunnelDestGroup(request), expectedError); - }); - }); - - describe('getTunnelDestGroup', () => { - it('invokes getTunnelDestGroup without error', async () => { - const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.GetTunnelDestGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.GetTunnelDestGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.iap.v1.TunnelDestGroup() - ); - client.innerApiCalls.getTunnelDestGroup = stubSimpleCall(expectedResponse); - const [response] = await client.getTunnelDestGroup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getTunnelDestGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getTunnelDestGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getTunnelDestGroup without error using callback', async () => { - const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.GetTunnelDestGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.GetTunnelDestGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.iap.v1.TunnelDestGroup() - ); - client.innerApiCalls.getTunnelDestGroup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getTunnelDestGroup( - request, - (err?: Error|null, result?: protos.google.cloud.iap.v1.ITunnelDestGroup|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getTunnelDestGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getTunnelDestGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getTunnelDestGroup with error', async () => { - const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.GetTunnelDestGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.GetTunnelDestGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getTunnelDestGroup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getTunnelDestGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.getTunnelDestGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getTunnelDestGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getTunnelDestGroup with closed client', async () => { - const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.GetTunnelDestGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.GetTunnelDestGroupRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getTunnelDestGroup(request), expectedError); - }); - }); - - describe('deleteTunnelDestGroup', () => { - it('invokes deleteTunnelDestGroup without error', async () => { - const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.DeleteTunnelDestGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.DeleteTunnelDestGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteTunnelDestGroup = stubSimpleCall(expectedResponse); - const [response] = await client.deleteTunnelDestGroup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteTunnelDestGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteTunnelDestGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteTunnelDestGroup without error using callback', async () => { - const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.DeleteTunnelDestGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.DeleteTunnelDestGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteTunnelDestGroup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteTunnelDestGroup( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteTunnelDestGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteTunnelDestGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteTunnelDestGroup with error', async () => { - const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.DeleteTunnelDestGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.DeleteTunnelDestGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteTunnelDestGroup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteTunnelDestGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteTunnelDestGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteTunnelDestGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteTunnelDestGroup with closed client', async () => { - const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.DeleteTunnelDestGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.DeleteTunnelDestGroupRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteTunnelDestGroup(request), expectedError); - }); - }); - - describe('updateTunnelDestGroup', () => { - it('invokes updateTunnelDestGroup without error', async () => { - const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.UpdateTunnelDestGroupRequest() - ); - request.tunnelDestGroup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.UpdateTunnelDestGroupRequest', ['tunnelDestGroup', 'name']); - request.tunnelDestGroup.name = defaultValue1; - const expectedHeaderRequestParams = `tunnel_dest_group.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.iap.v1.TunnelDestGroup() - ); - client.innerApiCalls.updateTunnelDestGroup = stubSimpleCall(expectedResponse); - const [response] = await client.updateTunnelDestGroup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateTunnelDestGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateTunnelDestGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateTunnelDestGroup without error using callback', async () => { - const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.UpdateTunnelDestGroupRequest() - ); - request.tunnelDestGroup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.UpdateTunnelDestGroupRequest', ['tunnelDestGroup', 'name']); - request.tunnelDestGroup.name = defaultValue1; - const expectedHeaderRequestParams = `tunnel_dest_group.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.iap.v1.TunnelDestGroup() - ); - client.innerApiCalls.updateTunnelDestGroup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateTunnelDestGroup( - request, - (err?: Error|null, result?: protos.google.cloud.iap.v1.ITunnelDestGroup|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateTunnelDestGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateTunnelDestGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateTunnelDestGroup with error', async () => { - const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.UpdateTunnelDestGroupRequest() - ); - request.tunnelDestGroup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.UpdateTunnelDestGroupRequest', ['tunnelDestGroup', 'name']); - request.tunnelDestGroup.name = defaultValue1; - const expectedHeaderRequestParams = `tunnel_dest_group.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateTunnelDestGroup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateTunnelDestGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.updateTunnelDestGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateTunnelDestGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateTunnelDestGroup with closed client', async () => { - const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.UpdateTunnelDestGroupRequest() - ); - request.tunnelDestGroup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.UpdateTunnelDestGroupRequest', ['tunnelDestGroup', 'name']); - request.tunnelDestGroup.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateTunnelDestGroup(request), expectedError); - }); - }); - - describe('listTunnelDestGroups', () => { - it('invokes listTunnelDestGroups without error', async () => { - const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.ListTunnelDestGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.ListTunnelDestGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.iap.v1.TunnelDestGroup()), - generateSampleMessage(new protos.google.cloud.iap.v1.TunnelDestGroup()), - generateSampleMessage(new protos.google.cloud.iap.v1.TunnelDestGroup()), - ]; - client.innerApiCalls.listTunnelDestGroups = stubSimpleCall(expectedResponse); - const [response] = await client.listTunnelDestGroups(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listTunnelDestGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTunnelDestGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listTunnelDestGroups without error using callback', async () => { - const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.ListTunnelDestGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.ListTunnelDestGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.iap.v1.TunnelDestGroup()), - generateSampleMessage(new protos.google.cloud.iap.v1.TunnelDestGroup()), - generateSampleMessage(new protos.google.cloud.iap.v1.TunnelDestGroup()), - ]; - client.innerApiCalls.listTunnelDestGroups = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listTunnelDestGroups( - request, - (err?: Error|null, result?: protos.google.cloud.iap.v1.ITunnelDestGroup[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listTunnelDestGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTunnelDestGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listTunnelDestGroups with error', async () => { - const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.ListTunnelDestGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.ListTunnelDestGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listTunnelDestGroups = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listTunnelDestGroups(request), expectedError); - const actualRequest = (client.innerApiCalls.listTunnelDestGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTunnelDestGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listTunnelDestGroupsStream without error', async () => { - const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.ListTunnelDestGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.ListTunnelDestGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.iap.v1.TunnelDestGroup()), - generateSampleMessage(new protos.google.cloud.iap.v1.TunnelDestGroup()), - generateSampleMessage(new protos.google.cloud.iap.v1.TunnelDestGroup()), - ]; - client.descriptors.page.listTunnelDestGroups.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listTunnelDestGroupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.iap.v1.TunnelDestGroup[] = []; - stream.on('data', (response: protos.google.cloud.iap.v1.TunnelDestGroup) => { - 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.listTunnelDestGroups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listTunnelDestGroups, request)); - assert( - (client.descriptors.page.listTunnelDestGroups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listTunnelDestGroupsStream with error', async () => { - const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.ListTunnelDestGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.ListTunnelDestGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listTunnelDestGroups.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listTunnelDestGroupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.iap.v1.TunnelDestGroup[] = []; - stream.on('data', (response: protos.google.cloud.iap.v1.TunnelDestGroup) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listTunnelDestGroups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listTunnelDestGroups, request)); - assert( - (client.descriptors.page.listTunnelDestGroups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listTunnelDestGroups without error', async () => { - const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.ListTunnelDestGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.ListTunnelDestGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.iap.v1.TunnelDestGroup()), - generateSampleMessage(new protos.google.cloud.iap.v1.TunnelDestGroup()), - generateSampleMessage(new protos.google.cloud.iap.v1.TunnelDestGroup()), - ]; - client.descriptors.page.listTunnelDestGroups.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.iap.v1.ITunnelDestGroup[] = []; - const iterable = client.listTunnelDestGroupsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listTunnelDestGroups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listTunnelDestGroups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listTunnelDestGroups with error', async () => { - const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.ListTunnelDestGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.ListTunnelDestGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listTunnelDestGroups.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listTunnelDestGroupsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.iap.v1.ITunnelDestGroup[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listTunnelDestGroups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listTunnelDestGroups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('tunnelDestGroup', () => { - const fakePath = "/rendered/path/tunnelDestGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - dest_group: "destGroupValue", - }; - const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.tunnelDestGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.tunnelDestGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('tunnelDestGroupPath', () => { - const result = client.tunnelDestGroupPath("projectValue", "locationValue", "destGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.tunnelDestGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromTunnelDestGroupName', () => { - const result = client.matchProjectFromTunnelDestGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.tunnelDestGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromTunnelDestGroupName', () => { - const result = client.matchLocationFromTunnelDestGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.tunnelDestGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDestGroupFromTunnelDestGroupName', () => { - const result = client.matchDestGroupFromTunnelDestGroupName(fakePath); - assert.strictEqual(result, "destGroupValue"); - assert((client.pathTemplates.tunnelDestGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('tunnelLocation', () => { - const fakePath = "/rendered/path/tunnelLocation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new identityawareproxyadminserviceModule.v1.IdentityAwareProxyAdminServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.tunnelLocationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.tunnelLocationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('tunnelLocationPath', () => { - const result = client.tunnelLocationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.tunnelLocationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromTunnelLocationName', () => { - const result = client.matchProjectFromTunnelLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.tunnelLocationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromTunnelLocationName', () => { - const result = client.matchLocationFromTunnelLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.tunnelLocationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-iap/v1/test/gapic_identity_aware_proxy_o_auth_service_v1.ts b/owl-bot-staging/google-cloud-iap/v1/test/gapic_identity_aware_proxy_o_auth_service_v1.ts deleted file mode 100644 index c292536e2d5..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1/test/gapic_identity_aware_proxy_o_auth_service_v1.ts +++ /dev/null @@ -1,1315 +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 identityawareproxyoauthserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.IdentityAwareProxyOAuthServiceClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.identityAwareProxyOAuthServiceStub, undefined); - await client.initialize(); - assert(client.identityAwareProxyOAuthServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.identityAwareProxyOAuthServiceStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.identityAwareProxyOAuthServiceStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ - 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 identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ - 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('listBrands', () => { - it('invokes listBrands without error', async () => { - const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.ListBrandsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.ListBrandsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.iap.v1.ListBrandsResponse() - ); - client.innerApiCalls.listBrands = stubSimpleCall(expectedResponse); - const [response] = await client.listBrands(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBrands as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBrands as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBrands without error using callback', async () => { - const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.ListBrandsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.ListBrandsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.iap.v1.ListBrandsResponse() - ); - client.innerApiCalls.listBrands = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listBrands( - request, - (err?: Error|null, result?: protos.google.cloud.iap.v1.IListBrandsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBrands as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBrands as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBrands with error', async () => { - const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.ListBrandsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.ListBrandsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listBrands = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listBrands(request), expectedError); - const actualRequest = (client.innerApiCalls.listBrands as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBrands as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBrands with closed client', async () => { - const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.ListBrandsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.ListBrandsRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.listBrands(request), expectedError); - }); - }); - - describe('createBrand', () => { - it('invokes createBrand without error', async () => { - const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.CreateBrandRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.CreateBrandRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.iap.v1.Brand() - ); - client.innerApiCalls.createBrand = stubSimpleCall(expectedResponse); - const [response] = await client.createBrand(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBrand as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBrand as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBrand without error using callback', async () => { - const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.CreateBrandRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.CreateBrandRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.iap.v1.Brand() - ); - client.innerApiCalls.createBrand = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createBrand( - request, - (err?: Error|null, result?: protos.google.cloud.iap.v1.IBrand|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBrand as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBrand as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBrand with error', async () => { - const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.CreateBrandRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.CreateBrandRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createBrand = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createBrand(request), expectedError); - const actualRequest = (client.innerApiCalls.createBrand as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBrand as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBrand with closed client', async () => { - const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.CreateBrandRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.CreateBrandRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createBrand(request), expectedError); - }); - }); - - describe('getBrand', () => { - it('invokes getBrand without error', async () => { - const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.GetBrandRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.GetBrandRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.iap.v1.Brand() - ); - client.innerApiCalls.getBrand = stubSimpleCall(expectedResponse); - const [response] = await client.getBrand(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBrand as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBrand as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBrand without error using callback', async () => { - const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.GetBrandRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.GetBrandRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.iap.v1.Brand() - ); - client.innerApiCalls.getBrand = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getBrand( - request, - (err?: Error|null, result?: protos.google.cloud.iap.v1.IBrand|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBrand as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBrand as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBrand with error', async () => { - const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.GetBrandRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.GetBrandRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getBrand = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getBrand(request), expectedError); - const actualRequest = (client.innerApiCalls.getBrand as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBrand as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBrand with closed client', async () => { - const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.GetBrandRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.GetBrandRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getBrand(request), expectedError); - }); - }); - - describe('createIdentityAwareProxyClient', () => { - it('invokes createIdentityAwareProxyClient without error', async () => { - const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.CreateIdentityAwareProxyClientRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.CreateIdentityAwareProxyClientRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.iap.v1.IdentityAwareProxyClient() - ); - client.innerApiCalls.createIdentityAwareProxyClient = stubSimpleCall(expectedResponse); - const [response] = await client.createIdentityAwareProxyClient(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createIdentityAwareProxyClient as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createIdentityAwareProxyClient as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createIdentityAwareProxyClient without error using callback', async () => { - const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.CreateIdentityAwareProxyClientRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.CreateIdentityAwareProxyClientRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.iap.v1.IdentityAwareProxyClient() - ); - client.innerApiCalls.createIdentityAwareProxyClient = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createIdentityAwareProxyClient( - request, - (err?: Error|null, result?: protos.google.cloud.iap.v1.IIdentityAwareProxyClient|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createIdentityAwareProxyClient as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createIdentityAwareProxyClient as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createIdentityAwareProxyClient with error', async () => { - const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.CreateIdentityAwareProxyClientRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.CreateIdentityAwareProxyClientRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createIdentityAwareProxyClient = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createIdentityAwareProxyClient(request), expectedError); - const actualRequest = (client.innerApiCalls.createIdentityAwareProxyClient as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createIdentityAwareProxyClient as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createIdentityAwareProxyClient with closed client', async () => { - const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.CreateIdentityAwareProxyClientRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.CreateIdentityAwareProxyClientRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createIdentityAwareProxyClient(request), expectedError); - }); - }); - - describe('getIdentityAwareProxyClient', () => { - it('invokes getIdentityAwareProxyClient without error', async () => { - const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.GetIdentityAwareProxyClientRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.GetIdentityAwareProxyClientRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.iap.v1.IdentityAwareProxyClient() - ); - client.innerApiCalls.getIdentityAwareProxyClient = stubSimpleCall(expectedResponse); - const [response] = await client.getIdentityAwareProxyClient(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getIdentityAwareProxyClient as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getIdentityAwareProxyClient as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getIdentityAwareProxyClient without error using callback', async () => { - const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.GetIdentityAwareProxyClientRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.GetIdentityAwareProxyClientRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.iap.v1.IdentityAwareProxyClient() - ); - client.innerApiCalls.getIdentityAwareProxyClient = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIdentityAwareProxyClient( - request, - (err?: Error|null, result?: protos.google.cloud.iap.v1.IIdentityAwareProxyClient|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getIdentityAwareProxyClient as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getIdentityAwareProxyClient as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getIdentityAwareProxyClient with error', async () => { - const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.GetIdentityAwareProxyClientRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.GetIdentityAwareProxyClientRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getIdentityAwareProxyClient = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIdentityAwareProxyClient(request), expectedError); - const actualRequest = (client.innerApiCalls.getIdentityAwareProxyClient as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getIdentityAwareProxyClient as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getIdentityAwareProxyClient with closed client', async () => { - const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.GetIdentityAwareProxyClientRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.GetIdentityAwareProxyClientRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getIdentityAwareProxyClient(request), expectedError); - }); - }); - - describe('resetIdentityAwareProxyClientSecret', () => { - it('invokes resetIdentityAwareProxyClientSecret without error', async () => { - const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.ResetIdentityAwareProxyClientSecretRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.ResetIdentityAwareProxyClientSecretRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.iap.v1.IdentityAwareProxyClient() - ); - client.innerApiCalls.resetIdentityAwareProxyClientSecret = stubSimpleCall(expectedResponse); - const [response] = await client.resetIdentityAwareProxyClientSecret(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.resetIdentityAwareProxyClientSecret as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resetIdentityAwareProxyClientSecret as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resetIdentityAwareProxyClientSecret without error using callback', async () => { - const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.ResetIdentityAwareProxyClientSecretRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.ResetIdentityAwareProxyClientSecretRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.iap.v1.IdentityAwareProxyClient() - ); - client.innerApiCalls.resetIdentityAwareProxyClientSecret = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.resetIdentityAwareProxyClientSecret( - request, - (err?: Error|null, result?: protos.google.cloud.iap.v1.IIdentityAwareProxyClient|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.resetIdentityAwareProxyClientSecret as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resetIdentityAwareProxyClientSecret as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resetIdentityAwareProxyClientSecret with error', async () => { - const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.ResetIdentityAwareProxyClientSecretRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.ResetIdentityAwareProxyClientSecretRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.resetIdentityAwareProxyClientSecret = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.resetIdentityAwareProxyClientSecret(request), expectedError); - const actualRequest = (client.innerApiCalls.resetIdentityAwareProxyClientSecret as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resetIdentityAwareProxyClientSecret as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resetIdentityAwareProxyClientSecret with closed client', async () => { - const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.ResetIdentityAwareProxyClientSecretRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.ResetIdentityAwareProxyClientSecretRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.resetIdentityAwareProxyClientSecret(request), expectedError); - }); - }); - - describe('deleteIdentityAwareProxyClient', () => { - it('invokes deleteIdentityAwareProxyClient without error', async () => { - const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.DeleteIdentityAwareProxyClientRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.DeleteIdentityAwareProxyClientRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteIdentityAwareProxyClient = stubSimpleCall(expectedResponse); - const [response] = await client.deleteIdentityAwareProxyClient(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteIdentityAwareProxyClient as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteIdentityAwareProxyClient as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteIdentityAwareProxyClient without error using callback', async () => { - const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.DeleteIdentityAwareProxyClientRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.DeleteIdentityAwareProxyClientRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteIdentityAwareProxyClient = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteIdentityAwareProxyClient( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteIdentityAwareProxyClient as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteIdentityAwareProxyClient as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteIdentityAwareProxyClient with error', async () => { - const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.DeleteIdentityAwareProxyClientRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.DeleteIdentityAwareProxyClientRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteIdentityAwareProxyClient = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteIdentityAwareProxyClient(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteIdentityAwareProxyClient as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteIdentityAwareProxyClient as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteIdentityAwareProxyClient with closed client', async () => { - const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.DeleteIdentityAwareProxyClientRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.DeleteIdentityAwareProxyClientRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteIdentityAwareProxyClient(request), expectedError); - }); - }); - - describe('listIdentityAwareProxyClients', () => { - it('invokes listIdentityAwareProxyClients without error', async () => { - const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.ListIdentityAwareProxyClientsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.ListIdentityAwareProxyClientsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.iap.v1.IdentityAwareProxyClient()), - generateSampleMessage(new protos.google.cloud.iap.v1.IdentityAwareProxyClient()), - generateSampleMessage(new protos.google.cloud.iap.v1.IdentityAwareProxyClient()), - ]; - client.innerApiCalls.listIdentityAwareProxyClients = stubSimpleCall(expectedResponse); - const [response] = await client.listIdentityAwareProxyClients(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listIdentityAwareProxyClients as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listIdentityAwareProxyClients as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listIdentityAwareProxyClients without error using callback', async () => { - const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.ListIdentityAwareProxyClientsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.ListIdentityAwareProxyClientsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.iap.v1.IdentityAwareProxyClient()), - generateSampleMessage(new protos.google.cloud.iap.v1.IdentityAwareProxyClient()), - generateSampleMessage(new protos.google.cloud.iap.v1.IdentityAwareProxyClient()), - ]; - client.innerApiCalls.listIdentityAwareProxyClients = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listIdentityAwareProxyClients( - request, - (err?: Error|null, result?: protos.google.cloud.iap.v1.IIdentityAwareProxyClient[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listIdentityAwareProxyClients as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listIdentityAwareProxyClients as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listIdentityAwareProxyClients with error', async () => { - const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.ListIdentityAwareProxyClientsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.ListIdentityAwareProxyClientsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listIdentityAwareProxyClients = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listIdentityAwareProxyClients(request), expectedError); - const actualRequest = (client.innerApiCalls.listIdentityAwareProxyClients as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listIdentityAwareProxyClients as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listIdentityAwareProxyClientsStream without error', async () => { - const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.ListIdentityAwareProxyClientsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.ListIdentityAwareProxyClientsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.iap.v1.IdentityAwareProxyClient()), - generateSampleMessage(new protos.google.cloud.iap.v1.IdentityAwareProxyClient()), - generateSampleMessage(new protos.google.cloud.iap.v1.IdentityAwareProxyClient()), - ]; - client.descriptors.page.listIdentityAwareProxyClients.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listIdentityAwareProxyClientsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.iap.v1.IdentityAwareProxyClient[] = []; - stream.on('data', (response: protos.google.cloud.iap.v1.IdentityAwareProxyClient) => { - 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.listIdentityAwareProxyClients.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listIdentityAwareProxyClients, request)); - assert( - (client.descriptors.page.listIdentityAwareProxyClients.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listIdentityAwareProxyClientsStream with error', async () => { - const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.ListIdentityAwareProxyClientsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.ListIdentityAwareProxyClientsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listIdentityAwareProxyClients.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listIdentityAwareProxyClientsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.iap.v1.IdentityAwareProxyClient[] = []; - stream.on('data', (response: protos.google.cloud.iap.v1.IdentityAwareProxyClient) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listIdentityAwareProxyClients.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listIdentityAwareProxyClients, request)); - assert( - (client.descriptors.page.listIdentityAwareProxyClients.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listIdentityAwareProxyClients without error', async () => { - const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.ListIdentityAwareProxyClientsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.ListIdentityAwareProxyClientsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.iap.v1.IdentityAwareProxyClient()), - generateSampleMessage(new protos.google.cloud.iap.v1.IdentityAwareProxyClient()), - generateSampleMessage(new protos.google.cloud.iap.v1.IdentityAwareProxyClient()), - ]; - client.descriptors.page.listIdentityAwareProxyClients.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.iap.v1.IIdentityAwareProxyClient[] = []; - const iterable = client.listIdentityAwareProxyClientsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listIdentityAwareProxyClients.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listIdentityAwareProxyClients.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listIdentityAwareProxyClients with error', async () => { - const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.iap.v1.ListIdentityAwareProxyClientsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.iap.v1.ListIdentityAwareProxyClientsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listIdentityAwareProxyClients.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listIdentityAwareProxyClientsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.iap.v1.IIdentityAwareProxyClient[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listIdentityAwareProxyClients.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listIdentityAwareProxyClients.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('tunnelDestGroup', () => { - const fakePath = "/rendered/path/tunnelDestGroup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - dest_group: "destGroupValue", - }; - const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.tunnelDestGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.tunnelDestGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('tunnelDestGroupPath', () => { - const result = client.tunnelDestGroupPath("projectValue", "locationValue", "destGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.tunnelDestGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromTunnelDestGroupName', () => { - const result = client.matchProjectFromTunnelDestGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.tunnelDestGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromTunnelDestGroupName', () => { - const result = client.matchLocationFromTunnelDestGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.tunnelDestGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDestGroupFromTunnelDestGroupName', () => { - const result = client.matchDestGroupFromTunnelDestGroupName(fakePath); - assert.strictEqual(result, "destGroupValue"); - assert((client.pathTemplates.tunnelDestGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('tunnelLocation', () => { - const fakePath = "/rendered/path/tunnelLocation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new identityawareproxyoauthserviceModule.v1.IdentityAwareProxyOAuthServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.tunnelLocationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.tunnelLocationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('tunnelLocationPath', () => { - const result = client.tunnelLocationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.tunnelLocationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromTunnelLocationName', () => { - const result = client.matchProjectFromTunnelLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.tunnelLocationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromTunnelLocationName', () => { - const result = client.matchLocationFromTunnelLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.tunnelLocationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-iap/v1/tsconfig.json b/owl-bot-staging/google-cloud-iap/v1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-iap/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/google-cloud-iap/v1/webpack.config.js b/owl-bot-staging/google-cloud-iap/v1/webpack.config.js deleted file mode 100644 index 8b5bcd41c97..00000000000 --- a/owl-bot-staging/google-cloud-iap/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: 'IdentityAwareProxyAdminService', - filename: './identity-aware-proxy-admin-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/google-cloud-iap/v1beta1/.eslintignore b/owl-bot-staging/google-cloud-iap/v1beta1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1beta1/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/owl-bot-staging/google-cloud-iap/v1beta1/.eslintrc.json b/owl-bot-staging/google-cloud-iap/v1beta1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1beta1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-iap/v1beta1/.gitignore b/owl-bot-staging/google-cloud-iap/v1beta1/.gitignore deleted file mode 100644 index 5d32b23782f..00000000000 --- a/owl-bot-staging/google-cloud-iap/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/google-cloud-iap/v1beta1/.jsdoc.js b/owl-bot-staging/google-cloud-iap/v1beta1/.jsdoc.js deleted file mode 100644 index c516e1ec527..00000000000 --- a/owl-bot-staging/google-cloud-iap/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/iap', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-iap/v1beta1/.mocharc.js b/owl-bot-staging/google-cloud-iap/v1beta1/.mocharc.js deleted file mode 100644 index 481c522b00f..00000000000 --- a/owl-bot-staging/google-cloud-iap/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/google-cloud-iap/v1beta1/.prettierrc.js b/owl-bot-staging/google-cloud-iap/v1beta1/.prettierrc.js deleted file mode 100644 index 494e147865d..00000000000 --- a/owl-bot-staging/google-cloud-iap/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/google-cloud-iap/v1beta1/README.md b/owl-bot-staging/google-cloud-iap/v1beta1/README.md deleted file mode 100644 index 1ede6beeb65..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1beta1/README.md +++ /dev/null @@ -1 +0,0 @@ -Iap: Nodejs Client diff --git a/owl-bot-staging/google-cloud-iap/v1beta1/linkinator.config.json b/owl-bot-staging/google-cloud-iap/v1beta1/linkinator.config.json deleted file mode 100644 index befd23c8633..00000000000 --- a/owl-bot-staging/google-cloud-iap/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/google-cloud-iap/v1beta1/package.json b/owl-bot-staging/google-cloud-iap/v1beta1/package.json deleted file mode 100644 index 37f8296bc21..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1beta1/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "@google-cloud/iap", - "version": "0.1.0", - "description": "Iap client for Node.js", - "repository": "googleapis/nodejs-iap", - "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 iap", - "iap", - "identity aware proxy admin v1 beta1" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "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.5.2" - }, - "devDependencies": { - "@types/mocha": "^9.1.1", - "@types/node": "^16.11.62", - "@types/sinon": "^10.0.13", - "c8": "^7.12.0", - "gts": "^3.1.1", - "jsdoc": "^3.6.11", - "jsdoc-fresh": "^2.0.1", - "jsdoc-region-tag": "^2.0.1", - "linkinator": "^4.0.3", - "mocha": "^10.0.0", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^14.0.0", - "ts-loader": "^8.4.0", - "typescript": "^4.8.3", - "webpack": "^4.46.0", - "webpack-cli": "^4.10.0" - }, - "engines": { - "node": ">=v12" - } -} diff --git a/owl-bot-staging/google-cloud-iap/v1beta1/protos/google/cloud/iap/v1beta1/service.proto b/owl-bot-staging/google-cloud-iap/v1beta1/protos/google/cloud/iap/v1beta1/service.proto deleted file mode 100644 index a414a339be9..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1beta1/protos/google/cloud/iap/v1beta1/service.proto +++ /dev/null @@ -1,71 +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 -// -// 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.iap.v1beta1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/iam/v1/iam_policy.proto"; -import "google/iam/v1/policy.proto"; - -option go_package = "google.golang.org/genproto/googleapis/cloud/iap/v1beta1;iap"; -option java_multiple_files = true; -option java_package = "com.google.cloud.iap.v1beta1"; - -// APIs for Identity-Aware Proxy Admin configurations. -service IdentityAwareProxyAdminV1Beta1 { - option (google.api.default_host) = "iap.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Sets the access control policy for an Identity-Aware Proxy protected - // resource. Replaces any existing policy. - // More information about managing access via IAP can be found at: - // https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api - rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) - returns (google.iam.v1.Policy) { - option (google.api.http) = { - post: "/v1beta1/{resource=**}:setIamPolicy" - body: "*" - }; - } - - // Gets the access control policy for an Identity-Aware Proxy protected - // resource. - // More information about managing access via IAP can be found at: - // https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api - rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) - returns (google.iam.v1.Policy) { - option (google.api.http) = { - post: "/v1beta1/{resource=**}:getIamPolicy" - body: "*" - }; - } - - // Returns permissions that a caller has on the Identity-Aware Proxy protected - // resource. If the resource does not exist or the caller does not have - // Identity-Aware Proxy permissions a [google.rpc.Code.PERMISSION_DENIED] - // will be returned. - // More information about managing access via IAP can be found at: - // https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api - rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) - returns (google.iam.v1.TestIamPermissionsResponse) { - option (google.api.http) = { - post: "/v1beta1/{resource=**}:testIamPermissions" - body: "*" - }; - } -} diff --git a/owl-bot-staging/google-cloud-iap/v1beta1/samples/generated/v1beta1/identity_aware_proxy_admin_v1_beta1.get_iam_policy.js b/owl-bot-staging/google-cloud-iap/v1beta1/samples/generated/v1beta1/identity_aware_proxy_admin_v1_beta1.get_iam_policy.js deleted file mode 100644 index 5a419b76dd2..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1beta1/samples/generated/v1beta1/identity_aware_proxy_admin_v1_beta1.get_iam_policy.js +++ /dev/null @@ -1,67 +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(resource) { - // [START iap_v1beta1_generated_IdentityAwareProxyAdminV1Beta1_GetIamPolicy_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - */ - // const resource = 'abc123' - /** - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. - */ - // const options = {} - - // Imports the Iap library - const {IdentityAwareProxyAdminV1Beta1Client} = require('@google-cloud/iap').v1beta1; - - // Instantiates a client - const iapClient = new IdentityAwareProxyAdminV1Beta1Client(); - - async function callGetIamPolicy() { - // Construct request - const request = { - resource, - }; - - // Run request - const response = await iapClient.getIamPolicy(request); - console.log(response); - } - - callGetIamPolicy(); - // [END iap_v1beta1_generated_IdentityAwareProxyAdminV1Beta1_GetIamPolicy_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-iap/v1beta1/samples/generated/v1beta1/identity_aware_proxy_admin_v1_beta1.set_iam_policy.js b/owl-bot-staging/google-cloud-iap/v1beta1/samples/generated/v1beta1/identity_aware_proxy_admin_v1_beta1.set_iam_policy.js deleted file mode 100644 index d3c8a8fa50e..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1beta1/samples/generated/v1beta1/identity_aware_proxy_admin_v1_beta1.set_iam_policy.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(resource, policy) { - // [START iap_v1beta1_generated_IdentityAwareProxyAdminV1Beta1_SetIamPolicy_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - */ - // const resource = 'abc123' - /** - * REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - */ - // const policy = {} - /** - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * `paths: "bindings, etag"` - */ - // const updateMask = {} - - // Imports the Iap library - const {IdentityAwareProxyAdminV1Beta1Client} = require('@google-cloud/iap').v1beta1; - - // Instantiates a client - const iapClient = new IdentityAwareProxyAdminV1Beta1Client(); - - async function callSetIamPolicy() { - // Construct request - const request = { - resource, - policy, - }; - - // Run request - const response = await iapClient.setIamPolicy(request); - console.log(response); - } - - callSetIamPolicy(); - // [END iap_v1beta1_generated_IdentityAwareProxyAdminV1Beta1_SetIamPolicy_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-iap/v1beta1/samples/generated/v1beta1/identity_aware_proxy_admin_v1_beta1.test_iam_permissions.js b/owl-bot-staging/google-cloud-iap/v1beta1/samples/generated/v1beta1/identity_aware_proxy_admin_v1_beta1.test_iam_permissions.js deleted file mode 100644 index 21952d2c42b..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1beta1/samples/generated/v1beta1/identity_aware_proxy_admin_v1_beta1.test_iam_permissions.js +++ /dev/null @@ -1,70 +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(resource, permissions) { - // [START iap_v1beta1_generated_IdentityAwareProxyAdminV1Beta1_TestIamPermissions_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - */ - // const resource = 'abc123' - /** - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * IAM Overview (https://cloud.google.com/iam/docs/overview#permissions). - */ - // const permissions = 'abc123' - - // Imports the Iap library - const {IdentityAwareProxyAdminV1Beta1Client} = require('@google-cloud/iap').v1beta1; - - // Instantiates a client - const iapClient = new IdentityAwareProxyAdminV1Beta1Client(); - - async function callTestIamPermissions() { - // Construct request - const request = { - resource, - permissions, - }; - - // Run request - const response = await iapClient.testIamPermissions(request); - console.log(response); - } - - callTestIamPermissions(); - // [END iap_v1beta1_generated_IdentityAwareProxyAdminV1Beta1_TestIamPermissions_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-iap/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.iap.v1beta1.json b/owl-bot-staging/google-cloud-iap/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.iap.v1beta1.json deleted file mode 100644 index a3dad319632..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.iap.v1beta1.json +++ /dev/null @@ -1,151 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-iap", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.iap.v1beta1", - "version": "v1beta1" - } - ] - }, - "snippets": [ - { - "regionTag": "iap_v1beta1_generated_IdentityAwareProxyAdminV1Beta1_SetIamPolicy_async", - "title": "IdentityAwareProxyAdminV1Beta1 setIamPolicy Sample", - "origin": "API_DEFINITION", - "description": " Sets the access control policy for an Identity-Aware Proxy protected resource. Replaces any existing policy. More information about managing access via IAP can be found at: https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api", - "canonical": true, - "file": "identity_aware_proxy_admin_v1_beta1.set_iam_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetIamPolicy", - "fullName": "google.cloud.iap.v1beta1.IdentityAwareProxyAdminV1Beta1.SetIamPolicy", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "policy", - "type": ".google.iam.v1.Policy" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.iam.v1.Policy", - "client": { - "shortName": "IdentityAwareProxyAdminV1Beta1Client", - "fullName": "google.cloud.iap.v1beta1.IdentityAwareProxyAdminV1Beta1Client" - }, - "method": { - "shortName": "SetIamPolicy", - "fullName": "google.cloud.iap.v1beta1.IdentityAwareProxyAdminV1Beta1.SetIamPolicy", - "service": { - "shortName": "IdentityAwareProxyAdminV1Beta1", - "fullName": "google.cloud.iap.v1beta1.IdentityAwareProxyAdminV1Beta1" - } - } - } - }, - { - "regionTag": "iap_v1beta1_generated_IdentityAwareProxyAdminV1Beta1_GetIamPolicy_async", - "title": "IdentityAwareProxyAdminV1Beta1 getIamPolicy Sample", - "origin": "API_DEFINITION", - "description": " Gets the access control policy for an Identity-Aware Proxy protected resource. More information about managing access via IAP can be found at: https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api", - "canonical": true, - "file": "identity_aware_proxy_admin_v1_beta1.get_iam_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetIamPolicy", - "fullName": "google.cloud.iap.v1beta1.IdentityAwareProxyAdminV1Beta1.GetIamPolicy", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "options", - "type": ".google.iam.v1.GetPolicyOptions" - } - ], - "resultType": ".google.iam.v1.Policy", - "client": { - "shortName": "IdentityAwareProxyAdminV1Beta1Client", - "fullName": "google.cloud.iap.v1beta1.IdentityAwareProxyAdminV1Beta1Client" - }, - "method": { - "shortName": "GetIamPolicy", - "fullName": "google.cloud.iap.v1beta1.IdentityAwareProxyAdminV1Beta1.GetIamPolicy", - "service": { - "shortName": "IdentityAwareProxyAdminV1Beta1", - "fullName": "google.cloud.iap.v1beta1.IdentityAwareProxyAdminV1Beta1" - } - } - } - }, - { - "regionTag": "iap_v1beta1_generated_IdentityAwareProxyAdminV1Beta1_TestIamPermissions_async", - "title": "IdentityAwareProxyAdminV1Beta1 testIamPermissions Sample", - "origin": "API_DEFINITION", - "description": " Returns permissions that a caller has on the Identity-Aware Proxy protected resource. If the resource does not exist or the caller does not have Identity-Aware Proxy permissions a [google.rpc.Code.PERMISSION_DENIED] will be returned. More information about managing access via IAP can be found at: https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api", - "canonical": true, - "file": "identity_aware_proxy_admin_v1_beta1.test_iam_permissions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "TestIamPermissions", - "fullName": "google.cloud.iap.v1beta1.IdentityAwareProxyAdminV1Beta1.TestIamPermissions", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "permissions", - "type": "TYPE_STRING[]" - } - ], - "resultType": ".google.iam.v1.TestIamPermissionsResponse", - "client": { - "shortName": "IdentityAwareProxyAdminV1Beta1Client", - "fullName": "google.cloud.iap.v1beta1.IdentityAwareProxyAdminV1Beta1Client" - }, - "method": { - "shortName": "TestIamPermissions", - "fullName": "google.cloud.iap.v1beta1.IdentityAwareProxyAdminV1Beta1.TestIamPermissions", - "service": { - "shortName": "IdentityAwareProxyAdminV1Beta1", - "fullName": "google.cloud.iap.v1beta1.IdentityAwareProxyAdminV1Beta1" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-iap/v1beta1/src/index.ts b/owl-bot-staging/google-cloud-iap/v1beta1/src/index.ts deleted file mode 100644 index 98f130b8f62..00000000000 --- a/owl-bot-staging/google-cloud-iap/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 IdentityAwareProxyAdminV1Beta1Client = v1beta1.IdentityAwareProxyAdminV1Beta1Client; -type IdentityAwareProxyAdminV1Beta1Client = v1beta1.IdentityAwareProxyAdminV1Beta1Client; -export {v1beta1, IdentityAwareProxyAdminV1Beta1Client}; -export default {v1beta1, IdentityAwareProxyAdminV1Beta1Client}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-iap/v1beta1/src/v1beta1/gapic_metadata.json b/owl-bot-staging/google-cloud-iap/v1beta1/src/v1beta1/gapic_metadata.json deleted file mode 100644 index dfebdd030c1..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1beta1/src/v1beta1/gapic_metadata.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.iap.v1beta1", - "libraryPackage": "@google-cloud/iap", - "services": { - "IdentityAwareProxyAdminV1Beta1": { - "clients": { - "grpc": { - "libraryClient": "IdentityAwareProxyAdminV1Beta1Client", - "rpcs": { - "SetIamPolicy": { - "methods": [ - "setIamPolicy" - ] - }, - "GetIamPolicy": { - "methods": [ - "getIamPolicy" - ] - }, - "TestIamPermissions": { - "methods": [ - "testIamPermissions" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "IdentityAwareProxyAdminV1Beta1Client", - "rpcs": { - "SetIamPolicy": { - "methods": [ - "setIamPolicy" - ] - }, - "GetIamPolicy": { - "methods": [ - "getIamPolicy" - ] - }, - "TestIamPermissions": { - "methods": [ - "testIamPermissions" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-iap/v1beta1/src/v1beta1/identity_aware_proxy_admin_v1_beta1_client.ts b/owl-bot-staging/google-cloud-iap/v1beta1/src/v1beta1/identity_aware_proxy_admin_v1_beta1_client.ts deleted file mode 100644 index a4d7085bd6a..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1beta1/src/v1beta1/identity_aware_proxy_admin_v1_beta1_client.ts +++ /dev/null @@ -1,553 +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 type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1beta1/identity_aware_proxy_admin_v1_beta1_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './identity_aware_proxy_admin_v1_beta1_client_config.json'; -const version = require('../../../package.json').version; - -/** - * APIs for Identity-Aware Proxy Admin configurations. - * @class - * @memberof v1beta1 - */ -export class IdentityAwareProxyAdminV1Beta1Client { - 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}; - identityAwareProxyAdminV1Beta1Stub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of IdentityAwareProxyAdminV1Beta1Client. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new IdentityAwareProxyAdminV1Beta1Client({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof IdentityAwareProxyAdminV1Beta1Client; - 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); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.iap.v1beta1.IdentityAwareProxyAdminV1Beta1', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.identityAwareProxyAdminV1Beta1Stub) { - return this.identityAwareProxyAdminV1Beta1Stub; - } - - // Put together the "service stub" for - // google.cloud.iap.v1beta1.IdentityAwareProxyAdminV1Beta1. - this.identityAwareProxyAdminV1Beta1Stub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.iap.v1beta1.IdentityAwareProxyAdminV1Beta1') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.iap.v1beta1.IdentityAwareProxyAdminV1Beta1, - 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 identityAwareProxyAdminV1Beta1StubMethods = - ['setIamPolicy', 'getIamPolicy', 'testIamPermissions']; - for (const methodName of identityAwareProxyAdminV1Beta1StubMethods) { - const callPromise = this.identityAwareProxyAdminV1Beta1Stub.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 = - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.identityAwareProxyAdminV1Beta1Stub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'iap.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 'iap.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 -- - // ------------------- -/** - * Sets the access control policy for an Identity-Aware Proxy protected - * resource. Replaces any existing policy. - * More information about managing access via IAP can be found at: - * https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - * @param {google.iam.v1.Policy} request.policy - * REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - * @param {google.protobuf.FieldMask} request.updateMask - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * - * `paths: "bindings, etag"` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1beta1/identity_aware_proxy_admin_v1_beta1.set_iam_policy.js - * region_tag:iap_v1beta1_generated_IdentityAwareProxyAdminV1Beta1_SetIamPolicy_async - */ - setIamPolicy( - request?: protos.google.iam.v1.ISetIamPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined - ]>; - setIamPolicy( - request: protos.google.iam.v1.ISetIamPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - setIamPolicy( - request: protos.google.iam.v1.ISetIamPolicyRequest, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - setIamPolicy( - request?: protos.google.iam.v1.ISetIamPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'resource': request.resource ?? '', - }); - this.initialize(); - return this.innerApiCalls.setIamPolicy(request, options, callback); - } -/** - * Gets the access control policy for an Identity-Aware Proxy protected - * resource. - * More information about managing access via IAP can be found at: - * https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {google.iam.v1.GetPolicyOptions} request.options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1beta1/identity_aware_proxy_admin_v1_beta1.get_iam_policy.js - * region_tag:iap_v1beta1_generated_IdentityAwareProxyAdminV1Beta1_GetIamPolicy_async - */ - getIamPolicy( - request?: protos.google.iam.v1.IGetIamPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined - ]>; - getIamPolicy( - request: protos.google.iam.v1.IGetIamPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - getIamPolicy( - request: protos.google.iam.v1.IGetIamPolicyRequest, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - getIamPolicy( - request?: protos.google.iam.v1.IGetIamPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'resource': request.resource ?? '', - }); - this.initialize(); - return this.innerApiCalls.getIamPolicy(request, options, callback); - } -/** - * Returns permissions that a caller has on the Identity-Aware Proxy protected - * resource. If the resource does not exist or the caller does not have - * Identity-Aware Proxy permissions a [google.rpc.Code.PERMISSION_DENIED] - * will be returned. - * More information about managing access via IAP can be found at: - * https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1beta1/identity_aware_proxy_admin_v1_beta1.test_iam_permissions.js - * region_tag:iap_v1beta1_generated_IdentityAwareProxyAdminV1Beta1_TestIamPermissions_async - */ - testIamPermissions( - request?: protos.google.iam.v1.ITestIamPermissionsRequest, - options?: CallOptions): - Promise<[ - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined - ]>; - testIamPermissions( - request: protos.google.iam.v1.ITestIamPermissionsRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>): void; - testIamPermissions( - request: protos.google.iam.v1.ITestIamPermissionsRequest, - callback: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>): void; - testIamPermissions( - request?: protos.google.iam.v1.ITestIamPermissionsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'resource': request.resource ?? '', - }); - this.initialize(); - return this.innerApiCalls.testIamPermissions(request, options, callback); - } - - - /** - * 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.identityAwareProxyAdminV1Beta1Stub && !this._terminated) { - return this.identityAwareProxyAdminV1Beta1Stub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-iap/v1beta1/src/v1beta1/identity_aware_proxy_admin_v1_beta1_client_config.json b/owl-bot-staging/google-cloud-iap/v1beta1/src/v1beta1/identity_aware_proxy_admin_v1_beta1_client_config.json deleted file mode 100644 index 31b8915b35b..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1beta1/src/v1beta1/identity_aware_proxy_admin_v1_beta1_client_config.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "interfaces": { - "google.cloud.iap.v1beta1.IdentityAwareProxyAdminV1Beta1": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "SetIamPolicy": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetIamPolicy": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "TestIamPermissions": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-iap/v1beta1/src/v1beta1/identity_aware_proxy_admin_v1_beta1_proto_list.json b/owl-bot-staging/google-cloud-iap/v1beta1/src/v1beta1/identity_aware_proxy_admin_v1_beta1_proto_list.json deleted file mode 100644 index 64f18e846ca..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1beta1/src/v1beta1/identity_aware_proxy_admin_v1_beta1_proto_list.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/cloud/iap/v1beta1/service.proto" -] diff --git a/owl-bot-staging/google-cloud-iap/v1beta1/src/v1beta1/index.ts b/owl-bot-staging/google-cloud-iap/v1beta1/src/v1beta1/index.ts deleted file mode 100644 index a5b946a3b8b..00000000000 --- a/owl-bot-staging/google-cloud-iap/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 {IdentityAwareProxyAdminV1Beta1Client} from './identity_aware_proxy_admin_v1_beta1_client'; diff --git a/owl-bot-staging/google-cloud-iap/v1beta1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-iap/v1beta1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 033a604d4ac..00000000000 --- a/owl-bot-staging/google-cloud-iap/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 iap = require('@google-cloud/iap'); - -function main() { - const identityAwareProxyAdminV1Beta1Client = new iap.IdentityAwareProxyAdminV1Beta1Client(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-iap/v1beta1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-iap/v1beta1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 8439fc955c5..00000000000 --- a/owl-bot-staging/google-cloud-iap/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 {IdentityAwareProxyAdminV1Beta1Client} from '@google-cloud/iap'; - -// check that the client class type name can be used -function doStuffWithIdentityAwareProxyAdminV1Beta1Client(client: IdentityAwareProxyAdminV1Beta1Client) { - client.close(); -} - -function main() { - // check that the client instance can be created - const identityAwareProxyAdminV1Beta1Client = new IdentityAwareProxyAdminV1Beta1Client(); - doStuffWithIdentityAwareProxyAdminV1Beta1Client(identityAwareProxyAdminV1Beta1Client); -} - -main(); diff --git a/owl-bot-staging/google-cloud-iap/v1beta1/system-test/install.ts b/owl-bot-staging/google-cloud-iap/v1beta1/system-test/install.ts deleted file mode 100644 index 557a57558e1..00000000000 --- a/owl-bot-staging/google-cloud-iap/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/google-cloud-iap/v1beta1/test/gapic_identity_aware_proxy_admin_v1_beta1_v1beta1.ts b/owl-bot-staging/google-cloud-iap/v1beta1/test/gapic_identity_aware_proxy_admin_v1_beta1_v1beta1.ts deleted file mode 100644 index 454f8a99d0e..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1beta1/test/gapic_identity_aware_proxy_admin_v1_beta1_v1beta1.ts +++ /dev/null @@ -1,474 +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 identityawareproxyadminv1beta1Module from '../src'; - -import {protobuf} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .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); -} - -describe('v1beta1.IdentityAwareProxyAdminV1Beta1Client', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = identityawareproxyadminv1beta1Module.v1beta1.IdentityAwareProxyAdminV1Beta1Client.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = identityawareproxyadminv1beta1Module.v1beta1.IdentityAwareProxyAdminV1Beta1Client.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = identityawareproxyadminv1beta1Module.v1beta1.IdentityAwareProxyAdminV1Beta1Client.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new identityawareproxyadminv1beta1Module.v1beta1.IdentityAwareProxyAdminV1Beta1Client(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new identityawareproxyadminv1beta1Module.v1beta1.IdentityAwareProxyAdminV1Beta1Client({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new identityawareproxyadminv1beta1Module.v1beta1.IdentityAwareProxyAdminV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.identityAwareProxyAdminV1Beta1Stub, undefined); - await client.initialize(); - assert(client.identityAwareProxyAdminV1Beta1Stub); - }); - - it('has close method for the initialized client', done => { - const client = new identityawareproxyadminv1beta1Module.v1beta1.IdentityAwareProxyAdminV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.identityAwareProxyAdminV1Beta1Stub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new identityawareproxyadminv1beta1Module.v1beta1.IdentityAwareProxyAdminV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.identityAwareProxyAdminV1Beta1Stub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new identityawareproxyadminv1beta1Module.v1beta1.IdentityAwareProxyAdminV1Beta1Client({ - 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 identityawareproxyadminv1beta1Module.v1beta1.IdentityAwareProxyAdminV1Beta1Client({ - 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('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new identityawareproxyadminv1beta1Module.v1beta1.IdentityAwareProxyAdminV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.SetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.SetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.Policy() - ); - client.innerApiCalls.setIamPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.setIamPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setIamPolicy without error using callback', async () => { - const client = new identityawareproxyadminv1beta1Module.v1beta1.IdentityAwareProxyAdminV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.SetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.SetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.Policy() - ); - client.innerApiCalls.setIamPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setIamPolicy with error', async () => { - const client = new identityawareproxyadminv1beta1Module.v1beta1.IdentityAwareProxyAdminV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.SetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.SetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setIamPolicy with closed client', async () => { - const client = new identityawareproxyadminv1beta1Module.v1beta1.IdentityAwareProxyAdminV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.SetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.SetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.setIamPolicy(request), expectedError); - }); - }); - - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new identityawareproxyadminv1beta1Module.v1beta1.IdentityAwareProxyAdminV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.GetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.Policy() - ); - client.innerApiCalls.getIamPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.getIamPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getIamPolicy without error using callback', async () => { - const client = new identityawareproxyadminv1beta1Module.v1beta1.IdentityAwareProxyAdminV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.GetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.Policy() - ); - client.innerApiCalls.getIamPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getIamPolicy with error', async () => { - const client = new identityawareproxyadminv1beta1Module.v1beta1.IdentityAwareProxyAdminV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.GetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getIamPolicy with closed client', async () => { - const client = new identityawareproxyadminv1beta1Module.v1beta1.IdentityAwareProxyAdminV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.GetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getIamPolicy(request), expectedError); - }); - }); - - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new identityawareproxyadminv1beta1Module.v1beta1.IdentityAwareProxyAdminV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.TestIamPermissionsRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsResponse() - ); - client.innerApiCalls.testIamPermissions = stubSimpleCall(expectedResponse); - const [response] = await client.testIamPermissions(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes testIamPermissions without error using callback', async () => { - const client = new identityawareproxyadminv1beta1Module.v1beta1.IdentityAwareProxyAdminV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.TestIamPermissionsRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsResponse() - ); - client.innerApiCalls.testIamPermissions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - (err?: Error|null, result?: protos.google.iam.v1.ITestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes testIamPermissions with error', async () => { - const client = new identityawareproxyadminv1beta1Module.v1beta1.IdentityAwareProxyAdminV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.TestIamPermissionsRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request), expectedError); - const actualRequest = (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes testIamPermissions with closed client', async () => { - const client = new identityawareproxyadminv1beta1Module.v1beta1.IdentityAwareProxyAdminV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.TestIamPermissionsRequest', ['resource']); - request.resource = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.testIamPermissions(request), expectedError); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-iap/v1beta1/tsconfig.json b/owl-bot-staging/google-cloud-iap/v1beta1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-iap/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/google-cloud-iap/v1beta1/webpack.config.js b/owl-bot-staging/google-cloud-iap/v1beta1/webpack.config.js deleted file mode 100644 index e9830a9679b..00000000000 --- a/owl-bot-staging/google-cloud-iap/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: 'IdentityAwareProxyAdminV1Beta1', - filename: './identity-aware-proxy-admin-v1-beta1.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/packages/google-cloud-iap/protos/google/cloud/iap/v1/service.proto b/packages/google-cloud-iap/protos/google/cloud/iap/v1/service.proto index cb28b24c6e3..919009292c4 100644 --- a/packages/google-cloud-iap/protos/google/cloud/iap/v1/service.proto +++ b/packages/google-cloud-iap/protos/google/cloud/iap/v1/service.proto @@ -38,16 +38,20 @@ option (google.api.resource_definition) = { pattern: "projects/{project}/iap_tunnel/locations/{location}" }; +// The Cloud Identity-Aware Proxy API. + // APIs for Identity-Aware Proxy Admin configurations. service IdentityAwareProxyAdminService { option (google.api.default_host) = "iap.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; // Sets the access control policy for an Identity-Aware Proxy protected // resource. Replaces any existing policy. // More information about managing access via IAP can be found at: // https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api - rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) { + rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) + returns (google.iam.v1.Policy) { option (google.api.http) = { post: "/v1/{resource=**}:setIamPolicy" body: "*" @@ -58,7 +62,8 @@ service IdentityAwareProxyAdminService { // resource. // More information about managing access via IAP can be found at: // https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api - rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) { + rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) + returns (google.iam.v1.Policy) { option (google.api.http) = { post: "/v1/{resource=**}:getIamPolicy" body: "*" @@ -69,7 +74,8 @@ service IdentityAwareProxyAdminService { // resource. // More information about managing access via IAP can be found at: // https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api - rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) { + rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) + returns (google.iam.v1.TestIamPermissionsResponse) { option (google.api.http) = { post: "/v1/{resource=**}:testIamPermissions" body: "*" @@ -95,7 +101,8 @@ service IdentityAwareProxyAdminService { // Lists the existing TunnelDestGroups. To group across all locations, use a // `-` as the location ID. For example: // `/v1/projects/123/iap_tunnel/locations/-/destGroups` - rpc ListTunnelDestGroups(ListTunnelDestGroupsRequest) returns (ListTunnelDestGroupsResponse) { + rpc ListTunnelDestGroups(ListTunnelDestGroupsRequest) + returns (ListTunnelDestGroupsResponse) { option (google.api.http) = { get: "/v1/{parent=projects/*/iap_tunnel/locations/*}/destGroups" }; @@ -103,12 +110,14 @@ service IdentityAwareProxyAdminService { } // Creates a new TunnelDestGroup. - rpc CreateTunnelDestGroup(CreateTunnelDestGroupRequest) returns (TunnelDestGroup) { + rpc CreateTunnelDestGroup(CreateTunnelDestGroupRequest) + returns (TunnelDestGroup) { option (google.api.http) = { post: "/v1/{parent=projects/*/iap_tunnel/locations/*}/destGroups" body: "tunnel_dest_group" }; - option (google.api.method_signature) = "parent,tunnel_dest_group,tunnel_dest_group_id"; + option (google.api.method_signature) = + "parent,tunnel_dest_group,tunnel_dest_group_id"; } // Retrieves an existing TunnelDestGroup. @@ -120,7 +129,8 @@ service IdentityAwareProxyAdminService { } // Deletes a TunnelDestGroup. - rpc DeleteTunnelDestGroup(DeleteTunnelDestGroupRequest) returns (google.protobuf.Empty) { + rpc DeleteTunnelDestGroup(DeleteTunnelDestGroupRequest) + returns (google.protobuf.Empty) { option (google.api.http) = { delete: "/v1/{name=projects/*/iap_tunnel/locations/*/destGroups/*}" }; @@ -128,7 +138,8 @@ service IdentityAwareProxyAdminService { } // Updates a TunnelDestGroup. - rpc UpdateTunnelDestGroup(UpdateTunnelDestGroupRequest) returns (TunnelDestGroup) { + rpc UpdateTunnelDestGroup(UpdateTunnelDestGroupRequest) + returns (TunnelDestGroup) { option (google.api.http) = { patch: "/v1/{tunnel_dest_group.name=projects/*/iap_tunnel/locations/*/destGroups/*}" body: "tunnel_dest_group" @@ -188,13 +199,14 @@ message CreateTunnelDestGroupRequest { ]; // Required. The TunnelDestGroup to create. - TunnelDestGroup tunnel_dest_group = 2 [(google.api.field_behavior) = REQUIRED]; + TunnelDestGroup tunnel_dest_group = 2 + [(google.api.field_behavior) = REQUIRED]; - // Required. The ID to use for the TunnelDestGroup, which becomes the final component of - // the resource name. + // Required. The ID to use for the TunnelDestGroup, which becomes the final + // component of the resource name. // // This value must be 4-63 characters, and valid characters - // are `[a-z][0-9]-`. + // are `[a-z]-`. string tunnel_dest_group_id = 3 [(google.api.field_behavior) = REQUIRED]; } @@ -227,7 +239,8 @@ message DeleteTunnelDestGroupRequest { // The request to UpdateTunnelDestGroup. message UpdateTunnelDestGroupRequest { // Required. The new values for the TunnelDestGroup. - TunnelDestGroup tunnel_dest_group = 1 [(google.api.field_behavior) = REQUIRED]; + TunnelDestGroup tunnel_dest_group = 1 + [(google.api.field_behavior) = REQUIRED]; // A field mask that specifies which IAP settings to update. // If omitted, then all of the settings are updated. See @@ -242,100 +255,21 @@ message TunnelDestGroup { pattern: "projects/{project}/iap_tunnel/locations/{location}/destGroups/{dest_group}" }; - // Required. Immutable. Identifier for the TunnelDestGroup. Must be unique within the - // project. + // Required. Immutable. Identifier for the TunnelDestGroup. Must be unique + // within the project and contain only lower case letters (a-z) and dashes + // (-). string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.field_behavior) = IMMUTABLE ]; - // null List of CIDRs that this group applies to. + // Unordered list. List of CIDRs that this group applies to. repeated string cidrs = 2 [(google.api.field_behavior) = UNORDERED_LIST]; - // null List of FQDNs that this group applies to. + // Unordered list. List of FQDNs that this group applies to. repeated string fqdns = 3 [(google.api.field_behavior) = UNORDERED_LIST]; } -// API to programmatically create, list and retrieve Identity Aware Proxy (IAP) -// OAuth brands; and create, retrieve, delete and reset-secret of IAP OAuth -// clients. -service IdentityAwareProxyOAuthService { - option (google.api.default_host) = "iap.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Lists the existing brands for the project. - rpc ListBrands(ListBrandsRequest) returns (ListBrandsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*}/brands" - }; - } - - // Constructs a new OAuth brand for the project if one does not exist. - // The created brand is "internal only", meaning that OAuth clients created - // under it only accept requests from users who belong to the same Google - // Workspace organization as the project. The brand is created in an - // un-reviewed status. NOTE: The "internal only" status can be manually - // changed in the Google Cloud Console. Requires that a brand does not already - // exist for the project, and that the specified support email is owned by the - // caller. - rpc CreateBrand(CreateBrandRequest) returns (Brand) { - option (google.api.http) = { - post: "/v1/{parent=projects/*}/brands" - body: "brand" - }; - } - - // Retrieves the OAuth brand of the project. - rpc GetBrand(GetBrandRequest) returns (Brand) { - option (google.api.http) = { - get: "/v1/{name=projects/*/brands/*}" - }; - } - - // Creates an Identity Aware Proxy (IAP) OAuth client. The client is owned - // by IAP. Requires that the brand for the project exists and that it is - // set for internal-only use. - rpc CreateIdentityAwareProxyClient(CreateIdentityAwareProxyClientRequest) returns (IdentityAwareProxyClient) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/brands/*}/identityAwareProxyClients" - body: "identity_aware_proxy_client" - }; - } - - // Lists the existing clients for the brand. - rpc ListIdentityAwareProxyClients(ListIdentityAwareProxyClientsRequest) returns (ListIdentityAwareProxyClientsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/brands/*}/identityAwareProxyClients" - }; - } - - // Retrieves an Identity Aware Proxy (IAP) OAuth client. - // Requires that the client is owned by IAP. - rpc GetIdentityAwareProxyClient(GetIdentityAwareProxyClientRequest) returns (IdentityAwareProxyClient) { - option (google.api.http) = { - get: "/v1/{name=projects/*/brands/*/identityAwareProxyClients/*}" - }; - } - - // Resets an Identity Aware Proxy (IAP) OAuth client secret. Useful if the - // secret was compromised. Requires that the client is owned by IAP. - rpc ResetIdentityAwareProxyClientSecret(ResetIdentityAwareProxyClientSecretRequest) returns (IdentityAwareProxyClient) { - option (google.api.http) = { - post: "/v1/{name=projects/*/brands/*/identityAwareProxyClients/*}:resetSecret" - body: "*" - }; - } - - // Deletes an Identity Aware Proxy (IAP) OAuth client. Useful for removing - // obsolete clients, managing the number of clients in a given project, and - // cleaning up after tests. Requires that the client is owned by IAP. - rpc DeleteIdentityAwareProxyClient(DeleteIdentityAwareProxyClientRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/brands/*/identityAwareProxyClients/*}" - }; - } -} - // The request sent to GetIapSettings. message GetIapSettingsRequest { // Required. The resource name for which to retrieve the settings. @@ -382,6 +316,9 @@ message AccessSettings { // Settings to configure reauthentication policies in IAP. ReauthSettings reauth_settings = 6; + + // Settings to configure and enable allowed domains. + AllowedDomainsSettings allowed_domains_settings = 7; } // Allows customers to configure tenant_id for GCIP instance per-app. @@ -426,15 +363,11 @@ message ReauthSettings { // Reauthentication disabled. METHOD_UNSPECIFIED = 0; - // Mimics the behavior as if the user had logged out and tried to log in - // again. Users with 2SV (2-step verification) enabled see their 2SV - // challenges if they did not opt to have their second factor responses - // saved. Apps Core (GSuites) admins can configure settings to disable 2SV - // cookies and require 2SV for all Apps Core users in their domains. + // Prompts the user to log in again. LOGIN = 1; - // User must type their password. - PASSWORD = 2; + // Deprecated, no longer accepted by IAP APIs. + PASSWORD = 2 [deprecated = true]; // User must use their secure key 2nd factor device. SECURE_KEY = 3; @@ -453,7 +386,7 @@ message ReauthSettings { DEFAULT = 2; } - // Reauth method required by the policy. + // Reauth method requested. Method method = 1; // Reauth session lifetime, how long before a user has to reauthenticate @@ -465,9 +398,19 @@ message ReauthSettings { PolicyType policy_type = 3; } +// Configuration for IAP allowed domains. Lets you to restrict access to an app +// and allow access to only the domains that you list. +message AllowedDomainsSettings { + // Configuration for customers to opt in for the feature. + optional bool enable = 1; + + // List of trusted domains. + repeated string domains = 2; +} + // Wrapper over application specific settings for IAP. message ApplicationSettings { - // Settings to configure IAP's behavior for a CSM mesh. + // Settings to configure IAP's behavior for a service mesh. CsmSettings csm_settings = 1; // Customization for Access Denied page. @@ -476,12 +419,15 @@ message ApplicationSettings { // The Domain value to set for cookies generated by IAP. This value is not // validated by the API, but will be ignored at runtime if invalid. google.protobuf.StringValue cookie_domain = 3; + + // Settings to configure attribute propagation. + AttributePropagationSettings attribute_propagation_settings = 4; } -// Configuration for RCTokens generated for CSM workloads protected by IAP. -// RCTokens are IAP generated JWTs that can be verified at the application. The -// RCToken is primarily used for ISTIO deployments, and can be scoped to a -// single mesh by configuring the audience field accordingly +// Configuration for RCToken generated for service mesh workloads protected by +// IAP. RCToken are IAP generated JWTs that can be verified at the application. +// The RCToken is primarily used for service mesh deployments, and can be scoped +// to a single mesh by configuring the audience field accordingly. message CsmSettings { // Audience claim set in the generated RCToken. This value is not validated by // IAP. @@ -499,6 +445,154 @@ message AccessDeniedPageSettings { // Whether to generate a troubleshooting URL on access denied events to this // application. google.protobuf.BoolValue generate_troubleshooting_uri = 2; + + // Whether to generate remediation token on access denied events to this + // application. + optional google.protobuf.BoolValue remediation_token_generation_enabled = 3; +} + +// Configuration for propagating attributes to applications protected +// by IAP. +message AttributePropagationSettings { + // Supported output credentials for attribute propagation. Each output + // credential maps to a "field" in the response. For example, selecting JWT + // will propagate all attributes in the IAP JWT, header in the headers, etc. + enum OutputCredentials { + // No output credential. This is an unsupported default. + OUTPUT_CREDENTIALS_UNSPECIFIED = 0; + + // Propagate attributes in the headers with "x-goog-iap-attr-" prefix. + HEADER = 1; + + // Propagate attributes in the JWT of the form: `"additional_claims": { + // "my_attribute": ["value1", "value2"] }` + JWT = 2; + + // Propagate attributes in the RCToken of the form: `"additional_claims": { + // "my_attribute": ["value1", "value2"] }` + RCTOKEN = 3; + } + + // Raw string CEL expression. Must return a list of attributes. Maximum of 45 + // attributes can be selected. Expressions can select different attribute + // types from `attributes`: `attributes.saml_attributes`, + // `attributes.iap_attributes`. Limited functions are supported: + // - `filter: .filter(, )` -> returns a subset of + // `` where `` is true for every item. + // - `in: in ` -> returns true if `` contains `` + // - `selectByName: .selectByName()` -> returns the attribute + // in + // `` with the given `` name, otherwise returns empty. + // - `emitAs: .emitAs()` -> sets the `` name + // field to the given `` for propagation in selected output + // credentials. + // - `strict: .strict()` -> ignore the `x-goog-iap-attr-` prefix + // for the provided `` when propagating via the `HEADER` output + // credential, i.e. request headers. + // - `append: .append()` OR + // `.append()` -> append the provided `` or + // `` onto the end of ``. + // + // Example expression: `attributes.saml_attributes.filter(x, x.name in + // ['test']).append(attributes.iap_attributes.selectByName('exact').emitAs('custom').strict())` + optional string expression = 1; + + // Which output credentials attributes selected by the CEL expression should + // be propagated in. All attributes will be fully duplicated in each selected + // output credential. + repeated OutputCredentials output_credentials = 2; + + // Whether the provided attribute propagation settings should be evaluated on + // user requests. If set to true, attributes returned from the expression will + // be propagated in the set output credentials. + optional bool enable = 3; +} + +// API to programmatically create, list and retrieve Identity Aware Proxy (IAP) +// OAuth brands; and create, retrieve, delete and reset-secret of IAP OAuth +// clients. +service IdentityAwareProxyOAuthService { + option (google.api.default_host) = "iap.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Lists the existing brands for the project. + rpc ListBrands(ListBrandsRequest) returns (ListBrandsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*}/brands" + }; + } + + // Constructs a new OAuth brand for the project if one does not exist. + // The created brand is "internal only", meaning that OAuth clients created + // under it only accept requests from users who belong to the same Google + // Workspace organization as the project. The brand is created in an + // un-reviewed status. NOTE: The "internal only" status can be manually + // changed in the Google Cloud Console. Requires that a brand does not already + // exist for the project, and that the specified support email is owned by the + // caller. + rpc CreateBrand(CreateBrandRequest) returns (Brand) { + option (google.api.http) = { + post: "/v1/{parent=projects/*}/brands" + body: "brand" + }; + } + + // Retrieves the OAuth brand of the project. + rpc GetBrand(GetBrandRequest) returns (Brand) { + option (google.api.http) = { + get: "/v1/{name=projects/*/brands/*}" + }; + } + + // Creates an Identity Aware Proxy (IAP) OAuth client. The client is owned + // by IAP. Requires that the brand for the project exists and that it is + // set for internal-only use. + rpc CreateIdentityAwareProxyClient(CreateIdentityAwareProxyClientRequest) + returns (IdentityAwareProxyClient) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/brands/*}/identityAwareProxyClients" + body: "identity_aware_proxy_client" + }; + } + + // Lists the existing clients for the brand. + rpc ListIdentityAwareProxyClients(ListIdentityAwareProxyClientsRequest) + returns (ListIdentityAwareProxyClientsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/brands/*}/identityAwareProxyClients" + }; + } + + // Retrieves an Identity Aware Proxy (IAP) OAuth client. + // Requires that the client is owned by IAP. + rpc GetIdentityAwareProxyClient(GetIdentityAwareProxyClientRequest) + returns (IdentityAwareProxyClient) { + option (google.api.http) = { + get: "/v1/{name=projects/*/brands/*/identityAwareProxyClients/*}" + }; + } + + // Resets an Identity Aware Proxy (IAP) OAuth client secret. Useful if the + // secret was compromised. Requires that the client is owned by IAP. + rpc ResetIdentityAwareProxyClientSecret( + ResetIdentityAwareProxyClientSecretRequest) + returns (IdentityAwareProxyClient) { + option (google.api.http) = { + post: "/v1/{name=projects/*/brands/*/identityAwareProxyClients/*}:resetSecret" + body: "*" + }; + } + + // Deletes an Identity Aware Proxy (IAP) OAuth client. Useful for removing + // obsolete clients, managing the number of clients in a given project, and + // cleaning up after tests. Requires that the client is owned by IAP. + rpc DeleteIdentityAwareProxyClient(DeleteIdentityAwareProxyClientRequest) + returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/brands/*/identityAwareProxyClients/*}" + }; + } } // The request sent to ListBrands. @@ -571,7 +665,8 @@ message CreateIdentityAwareProxyClientRequest { string parent = 1 [(google.api.field_behavior) = REQUIRED]; // Required. Identity Aware Proxy Client to be created. - IdentityAwareProxyClient identity_aware_proxy_client = 2 [(google.api.field_behavior) = REQUIRED]; + IdentityAwareProxyClient identity_aware_proxy_client = 2 + [(google.api.field_behavior) = REQUIRED]; } // The request sent to GetIdentityAwareProxyClient. diff --git a/packages/google-cloud-iap/protos/protos.d.ts b/packages/google-cloud-iap/protos/protos.d.ts index e48b84cb1a4..211a5c6d2ff 100644 --- a/packages/google-cloud-iap/protos/protos.d.ts +++ b/packages/google-cloud-iap/protos/protos.d.ts @@ -987,198 +987,6 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Represents an IdentityAwareProxyOAuthService */ - class IdentityAwareProxyOAuthService extends $protobuf.rpc.Service { - - /** - * Constructs a new IdentityAwareProxyOAuthService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - - /** - * Creates new IdentityAwareProxyOAuthService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): IdentityAwareProxyOAuthService; - - /** - * Calls ListBrands. - * @param request ListBrandsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and ListBrandsResponse - */ - public listBrands(request: google.cloud.iap.v1.IListBrandsRequest, callback: google.cloud.iap.v1.IdentityAwareProxyOAuthService.ListBrandsCallback): void; - - /** - * Calls ListBrands. - * @param request ListBrandsRequest message or plain object - * @returns Promise - */ - public listBrands(request: google.cloud.iap.v1.IListBrandsRequest): Promise; - - /** - * Calls CreateBrand. - * @param request CreateBrandRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Brand - */ - public createBrand(request: google.cloud.iap.v1.ICreateBrandRequest, callback: google.cloud.iap.v1.IdentityAwareProxyOAuthService.CreateBrandCallback): void; - - /** - * Calls CreateBrand. - * @param request CreateBrandRequest message or plain object - * @returns Promise - */ - public createBrand(request: google.cloud.iap.v1.ICreateBrandRequest): Promise; - - /** - * Calls GetBrand. - * @param request GetBrandRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Brand - */ - public getBrand(request: google.cloud.iap.v1.IGetBrandRequest, callback: google.cloud.iap.v1.IdentityAwareProxyOAuthService.GetBrandCallback): void; - - /** - * Calls GetBrand. - * @param request GetBrandRequest message or plain object - * @returns Promise - */ - public getBrand(request: google.cloud.iap.v1.IGetBrandRequest): Promise; - - /** - * Calls CreateIdentityAwareProxyClient. - * @param request CreateIdentityAwareProxyClientRequest message or plain object - * @param callback Node-style callback called with the error, if any, and IdentityAwareProxyClient - */ - public createIdentityAwareProxyClient(request: google.cloud.iap.v1.ICreateIdentityAwareProxyClientRequest, callback: google.cloud.iap.v1.IdentityAwareProxyOAuthService.CreateIdentityAwareProxyClientCallback): void; - - /** - * Calls CreateIdentityAwareProxyClient. - * @param request CreateIdentityAwareProxyClientRequest message or plain object - * @returns Promise - */ - public createIdentityAwareProxyClient(request: google.cloud.iap.v1.ICreateIdentityAwareProxyClientRequest): Promise; - - /** - * Calls ListIdentityAwareProxyClients. - * @param request ListIdentityAwareProxyClientsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and ListIdentityAwareProxyClientsResponse - */ - public listIdentityAwareProxyClients(request: google.cloud.iap.v1.IListIdentityAwareProxyClientsRequest, callback: google.cloud.iap.v1.IdentityAwareProxyOAuthService.ListIdentityAwareProxyClientsCallback): void; - - /** - * Calls ListIdentityAwareProxyClients. - * @param request ListIdentityAwareProxyClientsRequest message or plain object - * @returns Promise - */ - public listIdentityAwareProxyClients(request: google.cloud.iap.v1.IListIdentityAwareProxyClientsRequest): Promise; - - /** - * Calls GetIdentityAwareProxyClient. - * @param request GetIdentityAwareProxyClientRequest message or plain object - * @param callback Node-style callback called with the error, if any, and IdentityAwareProxyClient - */ - public getIdentityAwareProxyClient(request: google.cloud.iap.v1.IGetIdentityAwareProxyClientRequest, callback: google.cloud.iap.v1.IdentityAwareProxyOAuthService.GetIdentityAwareProxyClientCallback): void; - - /** - * Calls GetIdentityAwareProxyClient. - * @param request GetIdentityAwareProxyClientRequest message or plain object - * @returns Promise - */ - public getIdentityAwareProxyClient(request: google.cloud.iap.v1.IGetIdentityAwareProxyClientRequest): Promise; - - /** - * Calls ResetIdentityAwareProxyClientSecret. - * @param request ResetIdentityAwareProxyClientSecretRequest message or plain object - * @param callback Node-style callback called with the error, if any, and IdentityAwareProxyClient - */ - public resetIdentityAwareProxyClientSecret(request: google.cloud.iap.v1.IResetIdentityAwareProxyClientSecretRequest, callback: google.cloud.iap.v1.IdentityAwareProxyOAuthService.ResetIdentityAwareProxyClientSecretCallback): void; - - /** - * Calls ResetIdentityAwareProxyClientSecret. - * @param request ResetIdentityAwareProxyClientSecretRequest message or plain object - * @returns Promise - */ - public resetIdentityAwareProxyClientSecret(request: google.cloud.iap.v1.IResetIdentityAwareProxyClientSecretRequest): Promise; - - /** - * Calls DeleteIdentityAwareProxyClient. - * @param request DeleteIdentityAwareProxyClientRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Empty - */ - public deleteIdentityAwareProxyClient(request: google.cloud.iap.v1.IDeleteIdentityAwareProxyClientRequest, callback: google.cloud.iap.v1.IdentityAwareProxyOAuthService.DeleteIdentityAwareProxyClientCallback): void; - - /** - * Calls DeleteIdentityAwareProxyClient. - * @param request DeleteIdentityAwareProxyClientRequest message or plain object - * @returns Promise - */ - public deleteIdentityAwareProxyClient(request: google.cloud.iap.v1.IDeleteIdentityAwareProxyClientRequest): Promise; - } - - namespace IdentityAwareProxyOAuthService { - - /** - * Callback as used by {@link google.cloud.iap.v1.IdentityAwareProxyOAuthService|listBrands}. - * @param error Error, if any - * @param [response] ListBrandsResponse - */ - type ListBrandsCallback = (error: (Error|null), response?: google.cloud.iap.v1.ListBrandsResponse) => void; - - /** - * Callback as used by {@link google.cloud.iap.v1.IdentityAwareProxyOAuthService|createBrand}. - * @param error Error, if any - * @param [response] Brand - */ - type CreateBrandCallback = (error: (Error|null), response?: google.cloud.iap.v1.Brand) => void; - - /** - * Callback as used by {@link google.cloud.iap.v1.IdentityAwareProxyOAuthService|getBrand}. - * @param error Error, if any - * @param [response] Brand - */ - type GetBrandCallback = (error: (Error|null), response?: google.cloud.iap.v1.Brand) => void; - - /** - * Callback as used by {@link google.cloud.iap.v1.IdentityAwareProxyOAuthService|createIdentityAwareProxyClient}. - * @param error Error, if any - * @param [response] IdentityAwareProxyClient - */ - type CreateIdentityAwareProxyClientCallback = (error: (Error|null), response?: google.cloud.iap.v1.IdentityAwareProxyClient) => void; - - /** - * Callback as used by {@link google.cloud.iap.v1.IdentityAwareProxyOAuthService|listIdentityAwareProxyClients}. - * @param error Error, if any - * @param [response] ListIdentityAwareProxyClientsResponse - */ - type ListIdentityAwareProxyClientsCallback = (error: (Error|null), response?: google.cloud.iap.v1.ListIdentityAwareProxyClientsResponse) => void; - - /** - * Callback as used by {@link google.cloud.iap.v1.IdentityAwareProxyOAuthService|getIdentityAwareProxyClient}. - * @param error Error, if any - * @param [response] IdentityAwareProxyClient - */ - type GetIdentityAwareProxyClientCallback = (error: (Error|null), response?: google.cloud.iap.v1.IdentityAwareProxyClient) => void; - - /** - * Callback as used by {@link google.cloud.iap.v1.IdentityAwareProxyOAuthService|resetIdentityAwareProxyClientSecret}. - * @param error Error, if any - * @param [response] IdentityAwareProxyClient - */ - type ResetIdentityAwareProxyClientSecretCallback = (error: (Error|null), response?: google.cloud.iap.v1.IdentityAwareProxyClient) => void; - - /** - * Callback as used by {@link google.cloud.iap.v1.IdentityAwareProxyOAuthService|deleteIdentityAwareProxyClient}. - * @param error Error, if any - * @param [response] Empty - */ - type DeleteIdentityAwareProxyClientCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; - } - /** Properties of a GetIapSettingsRequest. */ interface IGetIapSettingsRequest { @@ -1502,6 +1310,9 @@ export namespace google { /** AccessSettings reauthSettings */ reauthSettings?: (google.cloud.iap.v1.IReauthSettings|null); + + /** AccessSettings allowedDomainsSettings */ + allowedDomainsSettings?: (google.cloud.iap.v1.IAllowedDomainsSettings|null); } /** Represents an AccessSettings. */ @@ -1525,6 +1336,9 @@ export namespace google { /** AccessSettings reauthSettings. */ public reauthSettings?: (google.cloud.iap.v1.IReauthSettings|null); + /** AccessSettings allowedDomainsSettings. */ + public allowedDomainsSettings?: (google.cloud.iap.v1.IAllowedDomainsSettings|null); + /** * Creates a new AccessSettings instance using the specified properties. * @param [properties] Properties to set @@ -2027,124 +1841,236 @@ export namespace google { } } - /** Properties of an ApplicationSettings. */ - interface IApplicationSettings { - - /** ApplicationSettings csmSettings */ - csmSettings?: (google.cloud.iap.v1.ICsmSettings|null); + /** Properties of an AllowedDomainsSettings. */ + interface IAllowedDomainsSettings { - /** ApplicationSettings accessDeniedPageSettings */ - accessDeniedPageSettings?: (google.cloud.iap.v1.IAccessDeniedPageSettings|null); + /** AllowedDomainsSettings enable */ + enable?: (boolean|null); - /** ApplicationSettings cookieDomain */ - cookieDomain?: (google.protobuf.IStringValue|null); + /** AllowedDomainsSettings domains */ + domains?: (string[]|null); } - /** Represents an ApplicationSettings. */ - class ApplicationSettings implements IApplicationSettings { + /** Represents an AllowedDomainsSettings. */ + class AllowedDomainsSettings implements IAllowedDomainsSettings { /** - * Constructs a new ApplicationSettings. + * Constructs a new AllowedDomainsSettings. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.iap.v1.IApplicationSettings); + constructor(properties?: google.cloud.iap.v1.IAllowedDomainsSettings); - /** ApplicationSettings csmSettings. */ - public csmSettings?: (google.cloud.iap.v1.ICsmSettings|null); + /** AllowedDomainsSettings enable. */ + public enable?: (boolean|null); - /** ApplicationSettings accessDeniedPageSettings. */ - public accessDeniedPageSettings?: (google.cloud.iap.v1.IAccessDeniedPageSettings|null); + /** AllowedDomainsSettings domains. */ + public domains: string[]; - /** ApplicationSettings cookieDomain. */ - public cookieDomain?: (google.protobuf.IStringValue|null); + /** AllowedDomainsSettings _enable. */ + public _enable?: "enable"; /** - * Creates a new ApplicationSettings instance using the specified properties. + * Creates a new AllowedDomainsSettings instance using the specified properties. * @param [properties] Properties to set - * @returns ApplicationSettings instance + * @returns AllowedDomainsSettings instance */ - public static create(properties?: google.cloud.iap.v1.IApplicationSettings): google.cloud.iap.v1.ApplicationSettings; + public static create(properties?: google.cloud.iap.v1.IAllowedDomainsSettings): google.cloud.iap.v1.AllowedDomainsSettings; /** - * Encodes the specified ApplicationSettings message. Does not implicitly {@link google.cloud.iap.v1.ApplicationSettings.verify|verify} messages. - * @param message ApplicationSettings message or plain object to encode + * Encodes the specified AllowedDomainsSettings message. Does not implicitly {@link google.cloud.iap.v1.AllowedDomainsSettings.verify|verify} messages. + * @param message AllowedDomainsSettings message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.iap.v1.IApplicationSettings, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.iap.v1.IAllowedDomainsSettings, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ApplicationSettings message, length delimited. Does not implicitly {@link google.cloud.iap.v1.ApplicationSettings.verify|verify} messages. - * @param message ApplicationSettings message or plain object to encode + * Encodes the specified AllowedDomainsSettings message, length delimited. Does not implicitly {@link google.cloud.iap.v1.AllowedDomainsSettings.verify|verify} messages. + * @param message AllowedDomainsSettings message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.iap.v1.IApplicationSettings, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.iap.v1.IAllowedDomainsSettings, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an ApplicationSettings message from the specified reader or buffer. + * Decodes an AllowedDomainsSettings message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ApplicationSettings + * @returns AllowedDomainsSettings * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.iap.v1.ApplicationSettings; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.iap.v1.AllowedDomainsSettings; /** - * Decodes an ApplicationSettings message from the specified reader or buffer, length delimited. + * Decodes an AllowedDomainsSettings message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ApplicationSettings + * @returns AllowedDomainsSettings * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.iap.v1.ApplicationSettings; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.iap.v1.AllowedDomainsSettings; /** - * Verifies an ApplicationSettings message. + * Verifies an AllowedDomainsSettings message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an ApplicationSettings message from a plain object. Also converts values to their respective internal types. + * Creates an AllowedDomainsSettings message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ApplicationSettings + * @returns AllowedDomainsSettings */ - public static fromObject(object: { [k: string]: any }): google.cloud.iap.v1.ApplicationSettings; + public static fromObject(object: { [k: string]: any }): google.cloud.iap.v1.AllowedDomainsSettings; /** - * Creates a plain object from an ApplicationSettings message. Also converts values to other types if specified. - * @param message ApplicationSettings + * Creates a plain object from an AllowedDomainsSettings message. Also converts values to other types if specified. + * @param message AllowedDomainsSettings * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.iap.v1.ApplicationSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.iap.v1.AllowedDomainsSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ApplicationSettings to JSON. + * Converts this AllowedDomainsSettings to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for ApplicationSettings + * Gets the default type url for AllowedDomainsSettings * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of a CsmSettings. */ - interface ICsmSettings { + /** Properties of an ApplicationSettings. */ + interface IApplicationSettings { - /** CsmSettings rctokenAud */ - rctokenAud?: (google.protobuf.IStringValue|null); + /** ApplicationSettings csmSettings */ + csmSettings?: (google.cloud.iap.v1.ICsmSettings|null); + + /** ApplicationSettings accessDeniedPageSettings */ + accessDeniedPageSettings?: (google.cloud.iap.v1.IAccessDeniedPageSettings|null); + + /** ApplicationSettings cookieDomain */ + cookieDomain?: (google.protobuf.IStringValue|null); + + /** ApplicationSettings attributePropagationSettings */ + attributePropagationSettings?: (google.cloud.iap.v1.IAttributePropagationSettings|null); } - /** Represents a CsmSettings. */ - class CsmSettings implements ICsmSettings { + /** Represents an ApplicationSettings. */ + class ApplicationSettings implements IApplicationSettings { + + /** + * Constructs a new ApplicationSettings. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.iap.v1.IApplicationSettings); + + /** ApplicationSettings csmSettings. */ + public csmSettings?: (google.cloud.iap.v1.ICsmSettings|null); + + /** ApplicationSettings accessDeniedPageSettings. */ + public accessDeniedPageSettings?: (google.cloud.iap.v1.IAccessDeniedPageSettings|null); + + /** ApplicationSettings cookieDomain. */ + public cookieDomain?: (google.protobuf.IStringValue|null); + + /** ApplicationSettings attributePropagationSettings. */ + public attributePropagationSettings?: (google.cloud.iap.v1.IAttributePropagationSettings|null); + + /** + * Creates a new ApplicationSettings instance using the specified properties. + * @param [properties] Properties to set + * @returns ApplicationSettings instance + */ + public static create(properties?: google.cloud.iap.v1.IApplicationSettings): google.cloud.iap.v1.ApplicationSettings; + + /** + * Encodes the specified ApplicationSettings message. Does not implicitly {@link google.cloud.iap.v1.ApplicationSettings.verify|verify} messages. + * @param message ApplicationSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.iap.v1.IApplicationSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ApplicationSettings message, length delimited. Does not implicitly {@link google.cloud.iap.v1.ApplicationSettings.verify|verify} messages. + * @param message ApplicationSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.iap.v1.IApplicationSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ApplicationSettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ApplicationSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.iap.v1.ApplicationSettings; + + /** + * Decodes an ApplicationSettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ApplicationSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.iap.v1.ApplicationSettings; + + /** + * Verifies an ApplicationSettings message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ApplicationSettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ApplicationSettings + */ + public static fromObject(object: { [k: string]: any }): google.cloud.iap.v1.ApplicationSettings; + + /** + * Creates a plain object from an ApplicationSettings message. Also converts values to other types if specified. + * @param message ApplicationSettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.iap.v1.ApplicationSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ApplicationSettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ApplicationSettings + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CsmSettings. */ + interface ICsmSettings { + + /** CsmSettings rctokenAud */ + rctokenAud?: (google.protobuf.IStringValue|null); + } + + /** Represents a CsmSettings. */ + class CsmSettings implements ICsmSettings { /** * Constructs a new CsmSettings. @@ -2241,6 +2167,9 @@ export namespace google { /** AccessDeniedPageSettings generateTroubleshootingUri */ generateTroubleshootingUri?: (google.protobuf.IBoolValue|null); + + /** AccessDeniedPageSettings remediationTokenGenerationEnabled */ + remediationTokenGenerationEnabled?: (google.protobuf.IBoolValue|null); } /** Represents an AccessDeniedPageSettings. */ @@ -2258,6 +2187,12 @@ export namespace google { /** AccessDeniedPageSettings generateTroubleshootingUri. */ public generateTroubleshootingUri?: (google.protobuf.IBoolValue|null); + /** AccessDeniedPageSettings remediationTokenGenerationEnabled. */ + public remediationTokenGenerationEnabled?: (google.protobuf.IBoolValue|null); + + /** AccessDeniedPageSettings _remediationTokenGenerationEnabled. */ + public _remediationTokenGenerationEnabled?: "remediationTokenGenerationEnabled"; + /** * Creates a new AccessDeniedPageSettings instance using the specified properties. * @param [properties] Properties to set @@ -2336,6 +2271,324 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } + /** Properties of an AttributePropagationSettings. */ + interface IAttributePropagationSettings { + + /** AttributePropagationSettings expression */ + expression?: (string|null); + + /** AttributePropagationSettings outputCredentials */ + outputCredentials?: (google.cloud.iap.v1.AttributePropagationSettings.OutputCredentials[]|null); + + /** AttributePropagationSettings enable */ + enable?: (boolean|null); + } + + /** Represents an AttributePropagationSettings. */ + class AttributePropagationSettings implements IAttributePropagationSettings { + + /** + * Constructs a new AttributePropagationSettings. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.iap.v1.IAttributePropagationSettings); + + /** AttributePropagationSettings expression. */ + public expression?: (string|null); + + /** AttributePropagationSettings outputCredentials. */ + public outputCredentials: google.cloud.iap.v1.AttributePropagationSettings.OutputCredentials[]; + + /** AttributePropagationSettings enable. */ + public enable?: (boolean|null); + + /** AttributePropagationSettings _expression. */ + public _expression?: "expression"; + + /** AttributePropagationSettings _enable. */ + public _enable?: "enable"; + + /** + * Creates a new AttributePropagationSettings instance using the specified properties. + * @param [properties] Properties to set + * @returns AttributePropagationSettings instance + */ + public static create(properties?: google.cloud.iap.v1.IAttributePropagationSettings): google.cloud.iap.v1.AttributePropagationSettings; + + /** + * Encodes the specified AttributePropagationSettings message. Does not implicitly {@link google.cloud.iap.v1.AttributePropagationSettings.verify|verify} messages. + * @param message AttributePropagationSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.iap.v1.IAttributePropagationSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AttributePropagationSettings message, length delimited. Does not implicitly {@link google.cloud.iap.v1.AttributePropagationSettings.verify|verify} messages. + * @param message AttributePropagationSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.iap.v1.IAttributePropagationSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AttributePropagationSettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AttributePropagationSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.iap.v1.AttributePropagationSettings; + + /** + * Decodes an AttributePropagationSettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AttributePropagationSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.iap.v1.AttributePropagationSettings; + + /** + * Verifies an AttributePropagationSettings message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AttributePropagationSettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AttributePropagationSettings + */ + public static fromObject(object: { [k: string]: any }): google.cloud.iap.v1.AttributePropagationSettings; + + /** + * Creates a plain object from an AttributePropagationSettings message. Also converts values to other types if specified. + * @param message AttributePropagationSettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.iap.v1.AttributePropagationSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AttributePropagationSettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AttributePropagationSettings + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace AttributePropagationSettings { + + /** OutputCredentials enum. */ + enum OutputCredentials { + OUTPUT_CREDENTIALS_UNSPECIFIED = 0, + HEADER = 1, + JWT = 2, + RCTOKEN = 3 + } + } + + /** Represents an IdentityAwareProxyOAuthService */ + class IdentityAwareProxyOAuthService extends $protobuf.rpc.Service { + + /** + * Constructs a new IdentityAwareProxyOAuthService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new IdentityAwareProxyOAuthService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): IdentityAwareProxyOAuthService; + + /** + * Calls ListBrands. + * @param request ListBrandsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListBrandsResponse + */ + public listBrands(request: google.cloud.iap.v1.IListBrandsRequest, callback: google.cloud.iap.v1.IdentityAwareProxyOAuthService.ListBrandsCallback): void; + + /** + * Calls ListBrands. + * @param request ListBrandsRequest message or plain object + * @returns Promise + */ + public listBrands(request: google.cloud.iap.v1.IListBrandsRequest): Promise; + + /** + * Calls CreateBrand. + * @param request CreateBrandRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Brand + */ + public createBrand(request: google.cloud.iap.v1.ICreateBrandRequest, callback: google.cloud.iap.v1.IdentityAwareProxyOAuthService.CreateBrandCallback): void; + + /** + * Calls CreateBrand. + * @param request CreateBrandRequest message or plain object + * @returns Promise + */ + public createBrand(request: google.cloud.iap.v1.ICreateBrandRequest): Promise; + + /** + * Calls GetBrand. + * @param request GetBrandRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Brand + */ + public getBrand(request: google.cloud.iap.v1.IGetBrandRequest, callback: google.cloud.iap.v1.IdentityAwareProxyOAuthService.GetBrandCallback): void; + + /** + * Calls GetBrand. + * @param request GetBrandRequest message or plain object + * @returns Promise + */ + public getBrand(request: google.cloud.iap.v1.IGetBrandRequest): Promise; + + /** + * Calls CreateIdentityAwareProxyClient. + * @param request CreateIdentityAwareProxyClientRequest message or plain object + * @param callback Node-style callback called with the error, if any, and IdentityAwareProxyClient + */ + public createIdentityAwareProxyClient(request: google.cloud.iap.v1.ICreateIdentityAwareProxyClientRequest, callback: google.cloud.iap.v1.IdentityAwareProxyOAuthService.CreateIdentityAwareProxyClientCallback): void; + + /** + * Calls CreateIdentityAwareProxyClient. + * @param request CreateIdentityAwareProxyClientRequest message or plain object + * @returns Promise + */ + public createIdentityAwareProxyClient(request: google.cloud.iap.v1.ICreateIdentityAwareProxyClientRequest): Promise; + + /** + * Calls ListIdentityAwareProxyClients. + * @param request ListIdentityAwareProxyClientsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListIdentityAwareProxyClientsResponse + */ + public listIdentityAwareProxyClients(request: google.cloud.iap.v1.IListIdentityAwareProxyClientsRequest, callback: google.cloud.iap.v1.IdentityAwareProxyOAuthService.ListIdentityAwareProxyClientsCallback): void; + + /** + * Calls ListIdentityAwareProxyClients. + * @param request ListIdentityAwareProxyClientsRequest message or plain object + * @returns Promise + */ + public listIdentityAwareProxyClients(request: google.cloud.iap.v1.IListIdentityAwareProxyClientsRequest): Promise; + + /** + * Calls GetIdentityAwareProxyClient. + * @param request GetIdentityAwareProxyClientRequest message or plain object + * @param callback Node-style callback called with the error, if any, and IdentityAwareProxyClient + */ + public getIdentityAwareProxyClient(request: google.cloud.iap.v1.IGetIdentityAwareProxyClientRequest, callback: google.cloud.iap.v1.IdentityAwareProxyOAuthService.GetIdentityAwareProxyClientCallback): void; + + /** + * Calls GetIdentityAwareProxyClient. + * @param request GetIdentityAwareProxyClientRequest message or plain object + * @returns Promise + */ + public getIdentityAwareProxyClient(request: google.cloud.iap.v1.IGetIdentityAwareProxyClientRequest): Promise; + + /** + * Calls ResetIdentityAwareProxyClientSecret. + * @param request ResetIdentityAwareProxyClientSecretRequest message or plain object + * @param callback Node-style callback called with the error, if any, and IdentityAwareProxyClient + */ + public resetIdentityAwareProxyClientSecret(request: google.cloud.iap.v1.IResetIdentityAwareProxyClientSecretRequest, callback: google.cloud.iap.v1.IdentityAwareProxyOAuthService.ResetIdentityAwareProxyClientSecretCallback): void; + + /** + * Calls ResetIdentityAwareProxyClientSecret. + * @param request ResetIdentityAwareProxyClientSecretRequest message or plain object + * @returns Promise + */ + public resetIdentityAwareProxyClientSecret(request: google.cloud.iap.v1.IResetIdentityAwareProxyClientSecretRequest): Promise; + + /** + * Calls DeleteIdentityAwareProxyClient. + * @param request DeleteIdentityAwareProxyClientRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteIdentityAwareProxyClient(request: google.cloud.iap.v1.IDeleteIdentityAwareProxyClientRequest, callback: google.cloud.iap.v1.IdentityAwareProxyOAuthService.DeleteIdentityAwareProxyClientCallback): void; + + /** + * Calls DeleteIdentityAwareProxyClient. + * @param request DeleteIdentityAwareProxyClientRequest message or plain object + * @returns Promise + */ + public deleteIdentityAwareProxyClient(request: google.cloud.iap.v1.IDeleteIdentityAwareProxyClientRequest): Promise; + } + + namespace IdentityAwareProxyOAuthService { + + /** + * Callback as used by {@link google.cloud.iap.v1.IdentityAwareProxyOAuthService|listBrands}. + * @param error Error, if any + * @param [response] ListBrandsResponse + */ + type ListBrandsCallback = (error: (Error|null), response?: google.cloud.iap.v1.ListBrandsResponse) => void; + + /** + * Callback as used by {@link google.cloud.iap.v1.IdentityAwareProxyOAuthService|createBrand}. + * @param error Error, if any + * @param [response] Brand + */ + type CreateBrandCallback = (error: (Error|null), response?: google.cloud.iap.v1.Brand) => void; + + /** + * Callback as used by {@link google.cloud.iap.v1.IdentityAwareProxyOAuthService|getBrand}. + * @param error Error, if any + * @param [response] Brand + */ + type GetBrandCallback = (error: (Error|null), response?: google.cloud.iap.v1.Brand) => void; + + /** + * Callback as used by {@link google.cloud.iap.v1.IdentityAwareProxyOAuthService|createIdentityAwareProxyClient}. + * @param error Error, if any + * @param [response] IdentityAwareProxyClient + */ + type CreateIdentityAwareProxyClientCallback = (error: (Error|null), response?: google.cloud.iap.v1.IdentityAwareProxyClient) => void; + + /** + * Callback as used by {@link google.cloud.iap.v1.IdentityAwareProxyOAuthService|listIdentityAwareProxyClients}. + * @param error Error, if any + * @param [response] ListIdentityAwareProxyClientsResponse + */ + type ListIdentityAwareProxyClientsCallback = (error: (Error|null), response?: google.cloud.iap.v1.ListIdentityAwareProxyClientsResponse) => void; + + /** + * Callback as used by {@link google.cloud.iap.v1.IdentityAwareProxyOAuthService|getIdentityAwareProxyClient}. + * @param error Error, if any + * @param [response] IdentityAwareProxyClient + */ + type GetIdentityAwareProxyClientCallback = (error: (Error|null), response?: google.cloud.iap.v1.IdentityAwareProxyClient) => void; + + /** + * Callback as used by {@link google.cloud.iap.v1.IdentityAwareProxyOAuthService|resetIdentityAwareProxyClientSecret}. + * @param error Error, if any + * @param [response] IdentityAwareProxyClient + */ + type ResetIdentityAwareProxyClientSecretCallback = (error: (Error|null), response?: google.cloud.iap.v1.IdentityAwareProxyClient) => void; + + /** + * Callback as used by {@link google.cloud.iap.v1.IdentityAwareProxyOAuthService|deleteIdentityAwareProxyClient}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteIdentityAwareProxyClientCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + } + /** Properties of a ListBrandsRequest. */ interface IListBrandsRequest { diff --git a/packages/google-cloud-iap/protos/protos.js b/packages/google-cloud-iap/protos/protos.js index 59bc3784ef5..45cf505263c 100644 --- a/packages/google-cloud-iap/protos/protos.js +++ b/packages/google-cloud-iap/protos/protos.js @@ -2110,323 +2110,228 @@ return TunnelDestGroup; })(); - v1.IdentityAwareProxyOAuthService = (function() { + v1.GetIapSettingsRequest = (function() { /** - * Constructs a new IdentityAwareProxyOAuthService service. + * Properties of a GetIapSettingsRequest. * @memberof google.cloud.iap.v1 - * @classdesc Represents an IdentityAwareProxyOAuthService - * @extends $protobuf.rpc.Service + * @interface IGetIapSettingsRequest + * @property {string|null} [name] GetIapSettingsRequest name + */ + + /** + * Constructs a new GetIapSettingsRequest. + * @memberof google.cloud.iap.v1 + * @classdesc Represents a GetIapSettingsRequest. + * @implements IGetIapSettingsRequest * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @param {google.cloud.iap.v1.IGetIapSettingsRequest=} [properties] Properties to set */ - function IdentityAwareProxyOAuthService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + function GetIapSettingsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; } - (IdentityAwareProxyOAuthService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = IdentityAwareProxyOAuthService; + /** + * GetIapSettingsRequest name. + * @member {string} name + * @memberof google.cloud.iap.v1.GetIapSettingsRequest + * @instance + */ + GetIapSettingsRequest.prototype.name = ""; /** - * Creates new IdentityAwareProxyOAuthService service using the specified rpc implementation. + * Creates a new GetIapSettingsRequest instance using the specified properties. * @function create - * @memberof google.cloud.iap.v1.IdentityAwareProxyOAuthService + * @memberof google.cloud.iap.v1.GetIapSettingsRequest * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {IdentityAwareProxyOAuthService} RPC service. Useful where requests and/or responses are streamed. + * @param {google.cloud.iap.v1.IGetIapSettingsRequest=} [properties] Properties to set + * @returns {google.cloud.iap.v1.GetIapSettingsRequest} GetIapSettingsRequest instance */ - IdentityAwareProxyOAuthService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); + GetIapSettingsRequest.create = function create(properties) { + return new GetIapSettingsRequest(properties); }; /** - * Callback as used by {@link google.cloud.iap.v1.IdentityAwareProxyOAuthService|listBrands}. - * @memberof google.cloud.iap.v1.IdentityAwareProxyOAuthService - * @typedef ListBrandsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.iap.v1.ListBrandsResponse} [response] ListBrandsResponse + * Encodes the specified GetIapSettingsRequest message. Does not implicitly {@link google.cloud.iap.v1.GetIapSettingsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.iap.v1.GetIapSettingsRequest + * @static + * @param {google.cloud.iap.v1.IGetIapSettingsRequest} message GetIapSettingsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ + GetIapSettingsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; /** - * Calls ListBrands. - * @function listBrands - * @memberof google.cloud.iap.v1.IdentityAwareProxyOAuthService - * @instance - * @param {google.cloud.iap.v1.IListBrandsRequest} request ListBrandsRequest message or plain object - * @param {google.cloud.iap.v1.IdentityAwareProxyOAuthService.ListBrandsCallback} callback Node-style callback called with the error, if any, and ListBrandsResponse - * @returns {undefined} - * @variation 1 + * Encodes the specified GetIapSettingsRequest message, length delimited. Does not implicitly {@link google.cloud.iap.v1.GetIapSettingsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.iap.v1.GetIapSettingsRequest + * @static + * @param {google.cloud.iap.v1.IGetIapSettingsRequest} message GetIapSettingsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - Object.defineProperty(IdentityAwareProxyOAuthService.prototype.listBrands = function listBrands(request, callback) { - return this.rpcCall(listBrands, $root.google.cloud.iap.v1.ListBrandsRequest, $root.google.cloud.iap.v1.ListBrandsResponse, request, callback); - }, "name", { value: "ListBrands" }); + GetIapSettingsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; /** - * Calls ListBrands. - * @function listBrands - * @memberof google.cloud.iap.v1.IdentityAwareProxyOAuthService - * @instance - * @param {google.cloud.iap.v1.IListBrandsRequest} request ListBrandsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 + * Decodes a GetIapSettingsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.iap.v1.GetIapSettingsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.iap.v1.GetIapSettingsRequest} GetIapSettingsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ + GetIapSettingsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.iap.v1.GetIapSettingsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; /** - * Callback as used by {@link google.cloud.iap.v1.IdentityAwareProxyOAuthService|createBrand}. - * @memberof google.cloud.iap.v1.IdentityAwareProxyOAuthService - * @typedef CreateBrandCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.iap.v1.Brand} [response] Brand + * Decodes a GetIapSettingsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.iap.v1.GetIapSettingsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.iap.v1.GetIapSettingsRequest} GetIapSettingsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ + GetIapSettingsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; /** - * Calls CreateBrand. - * @function createBrand - * @memberof google.cloud.iap.v1.IdentityAwareProxyOAuthService - * @instance - * @param {google.cloud.iap.v1.ICreateBrandRequest} request CreateBrandRequest message or plain object - * @param {google.cloud.iap.v1.IdentityAwareProxyOAuthService.CreateBrandCallback} callback Node-style callback called with the error, if any, and Brand - * @returns {undefined} - * @variation 1 + * Verifies a GetIapSettingsRequest message. + * @function verify + * @memberof google.cloud.iap.v1.GetIapSettingsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Object.defineProperty(IdentityAwareProxyOAuthService.prototype.createBrand = function createBrand(request, callback) { - return this.rpcCall(createBrand, $root.google.cloud.iap.v1.CreateBrandRequest, $root.google.cloud.iap.v1.Brand, request, callback); - }, "name", { value: "CreateBrand" }); + GetIapSettingsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; /** - * Calls CreateBrand. - * @function createBrand - * @memberof google.cloud.iap.v1.IdentityAwareProxyOAuthService - * @instance - * @param {google.cloud.iap.v1.ICreateBrandRequest} request CreateBrandRequest message or plain object - * @returns {Promise} Promise - * @variation 2 + * Creates a GetIapSettingsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.iap.v1.GetIapSettingsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.iap.v1.GetIapSettingsRequest} GetIapSettingsRequest */ + GetIapSettingsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.iap.v1.GetIapSettingsRequest) + return object; + var message = new $root.google.cloud.iap.v1.GetIapSettingsRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; /** - * Callback as used by {@link google.cloud.iap.v1.IdentityAwareProxyOAuthService|getBrand}. - * @memberof google.cloud.iap.v1.IdentityAwareProxyOAuthService - * @typedef GetBrandCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.iap.v1.Brand} [response] Brand + * Creates a plain object from a GetIapSettingsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.iap.v1.GetIapSettingsRequest + * @static + * @param {google.cloud.iap.v1.GetIapSettingsRequest} message GetIapSettingsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object */ + GetIapSettingsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; /** - * Calls GetBrand. - * @function getBrand - * @memberof google.cloud.iap.v1.IdentityAwareProxyOAuthService + * Converts this GetIapSettingsRequest to JSON. + * @function toJSON + * @memberof google.cloud.iap.v1.GetIapSettingsRequest * @instance - * @param {google.cloud.iap.v1.IGetBrandRequest} request GetBrandRequest message or plain object - * @param {google.cloud.iap.v1.IdentityAwareProxyOAuthService.GetBrandCallback} callback Node-style callback called with the error, if any, and Brand - * @returns {undefined} - * @variation 1 + * @returns {Object.} JSON object */ - Object.defineProperty(IdentityAwareProxyOAuthService.prototype.getBrand = function getBrand(request, callback) { - return this.rpcCall(getBrand, $root.google.cloud.iap.v1.GetBrandRequest, $root.google.cloud.iap.v1.Brand, request, callback); - }, "name", { value: "GetBrand" }); + GetIapSettingsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; /** - * Calls GetBrand. - * @function getBrand - * @memberof google.cloud.iap.v1.IdentityAwareProxyOAuthService - * @instance - * @param {google.cloud.iap.v1.IGetBrandRequest} request GetBrandRequest message or plain object - * @returns {Promise} Promise - * @variation 2 + * Gets the default type url for GetIapSettingsRequest + * @function getTypeUrl + * @memberof google.cloud.iap.v1.GetIapSettingsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url */ + GetIapSettingsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.iap.v1.GetIapSettingsRequest"; + }; + + return GetIapSettingsRequest; + })(); + + v1.UpdateIapSettingsRequest = (function() { /** - * Callback as used by {@link google.cloud.iap.v1.IdentityAwareProxyOAuthService|createIdentityAwareProxyClient}. - * @memberof google.cloud.iap.v1.IdentityAwareProxyOAuthService - * @typedef CreateIdentityAwareProxyClientCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.iap.v1.IdentityAwareProxyClient} [response] IdentityAwareProxyClient - */ - - /** - * Calls CreateIdentityAwareProxyClient. - * @function createIdentityAwareProxyClient - * @memberof google.cloud.iap.v1.IdentityAwareProxyOAuthService - * @instance - * @param {google.cloud.iap.v1.ICreateIdentityAwareProxyClientRequest} request CreateIdentityAwareProxyClientRequest message or plain object - * @param {google.cloud.iap.v1.IdentityAwareProxyOAuthService.CreateIdentityAwareProxyClientCallback} callback Node-style callback called with the error, if any, and IdentityAwareProxyClient - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(IdentityAwareProxyOAuthService.prototype.createIdentityAwareProxyClient = function createIdentityAwareProxyClient(request, callback) { - return this.rpcCall(createIdentityAwareProxyClient, $root.google.cloud.iap.v1.CreateIdentityAwareProxyClientRequest, $root.google.cloud.iap.v1.IdentityAwareProxyClient, request, callback); - }, "name", { value: "CreateIdentityAwareProxyClient" }); - - /** - * Calls CreateIdentityAwareProxyClient. - * @function createIdentityAwareProxyClient - * @memberof google.cloud.iap.v1.IdentityAwareProxyOAuthService - * @instance - * @param {google.cloud.iap.v1.ICreateIdentityAwareProxyClientRequest} request CreateIdentityAwareProxyClientRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.iap.v1.IdentityAwareProxyOAuthService|listIdentityAwareProxyClients}. - * @memberof google.cloud.iap.v1.IdentityAwareProxyOAuthService - * @typedef ListIdentityAwareProxyClientsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.iap.v1.ListIdentityAwareProxyClientsResponse} [response] ListIdentityAwareProxyClientsResponse - */ - - /** - * Calls ListIdentityAwareProxyClients. - * @function listIdentityAwareProxyClients - * @memberof google.cloud.iap.v1.IdentityAwareProxyOAuthService - * @instance - * @param {google.cloud.iap.v1.IListIdentityAwareProxyClientsRequest} request ListIdentityAwareProxyClientsRequest message or plain object - * @param {google.cloud.iap.v1.IdentityAwareProxyOAuthService.ListIdentityAwareProxyClientsCallback} callback Node-style callback called with the error, if any, and ListIdentityAwareProxyClientsResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(IdentityAwareProxyOAuthService.prototype.listIdentityAwareProxyClients = function listIdentityAwareProxyClients(request, callback) { - return this.rpcCall(listIdentityAwareProxyClients, $root.google.cloud.iap.v1.ListIdentityAwareProxyClientsRequest, $root.google.cloud.iap.v1.ListIdentityAwareProxyClientsResponse, request, callback); - }, "name", { value: "ListIdentityAwareProxyClients" }); - - /** - * Calls ListIdentityAwareProxyClients. - * @function listIdentityAwareProxyClients - * @memberof google.cloud.iap.v1.IdentityAwareProxyOAuthService - * @instance - * @param {google.cloud.iap.v1.IListIdentityAwareProxyClientsRequest} request ListIdentityAwareProxyClientsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.iap.v1.IdentityAwareProxyOAuthService|getIdentityAwareProxyClient}. - * @memberof google.cloud.iap.v1.IdentityAwareProxyOAuthService - * @typedef GetIdentityAwareProxyClientCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.iap.v1.IdentityAwareProxyClient} [response] IdentityAwareProxyClient - */ - - /** - * Calls GetIdentityAwareProxyClient. - * @function getIdentityAwareProxyClient - * @memberof google.cloud.iap.v1.IdentityAwareProxyOAuthService - * @instance - * @param {google.cloud.iap.v1.IGetIdentityAwareProxyClientRequest} request GetIdentityAwareProxyClientRequest message or plain object - * @param {google.cloud.iap.v1.IdentityAwareProxyOAuthService.GetIdentityAwareProxyClientCallback} callback Node-style callback called with the error, if any, and IdentityAwareProxyClient - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(IdentityAwareProxyOAuthService.prototype.getIdentityAwareProxyClient = function getIdentityAwareProxyClient(request, callback) { - return this.rpcCall(getIdentityAwareProxyClient, $root.google.cloud.iap.v1.GetIdentityAwareProxyClientRequest, $root.google.cloud.iap.v1.IdentityAwareProxyClient, request, callback); - }, "name", { value: "GetIdentityAwareProxyClient" }); - - /** - * Calls GetIdentityAwareProxyClient. - * @function getIdentityAwareProxyClient - * @memberof google.cloud.iap.v1.IdentityAwareProxyOAuthService - * @instance - * @param {google.cloud.iap.v1.IGetIdentityAwareProxyClientRequest} request GetIdentityAwareProxyClientRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.iap.v1.IdentityAwareProxyOAuthService|resetIdentityAwareProxyClientSecret}. - * @memberof google.cloud.iap.v1.IdentityAwareProxyOAuthService - * @typedef ResetIdentityAwareProxyClientSecretCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.iap.v1.IdentityAwareProxyClient} [response] IdentityAwareProxyClient - */ - - /** - * Calls ResetIdentityAwareProxyClientSecret. - * @function resetIdentityAwareProxyClientSecret - * @memberof google.cloud.iap.v1.IdentityAwareProxyOAuthService - * @instance - * @param {google.cloud.iap.v1.IResetIdentityAwareProxyClientSecretRequest} request ResetIdentityAwareProxyClientSecretRequest message or plain object - * @param {google.cloud.iap.v1.IdentityAwareProxyOAuthService.ResetIdentityAwareProxyClientSecretCallback} callback Node-style callback called with the error, if any, and IdentityAwareProxyClient - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(IdentityAwareProxyOAuthService.prototype.resetIdentityAwareProxyClientSecret = function resetIdentityAwareProxyClientSecret(request, callback) { - return this.rpcCall(resetIdentityAwareProxyClientSecret, $root.google.cloud.iap.v1.ResetIdentityAwareProxyClientSecretRequest, $root.google.cloud.iap.v1.IdentityAwareProxyClient, request, callback); - }, "name", { value: "ResetIdentityAwareProxyClientSecret" }); - - /** - * Calls ResetIdentityAwareProxyClientSecret. - * @function resetIdentityAwareProxyClientSecret - * @memberof google.cloud.iap.v1.IdentityAwareProxyOAuthService - * @instance - * @param {google.cloud.iap.v1.IResetIdentityAwareProxyClientSecretRequest} request ResetIdentityAwareProxyClientSecretRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.iap.v1.IdentityAwareProxyOAuthService|deleteIdentityAwareProxyClient}. - * @memberof google.cloud.iap.v1.IdentityAwareProxyOAuthService - * @typedef DeleteIdentityAwareProxyClientCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.protobuf.Empty} [response] Empty - */ - - /** - * Calls DeleteIdentityAwareProxyClient. - * @function deleteIdentityAwareProxyClient - * @memberof google.cloud.iap.v1.IdentityAwareProxyOAuthService - * @instance - * @param {google.cloud.iap.v1.IDeleteIdentityAwareProxyClientRequest} request DeleteIdentityAwareProxyClientRequest message or plain object - * @param {google.cloud.iap.v1.IdentityAwareProxyOAuthService.DeleteIdentityAwareProxyClientCallback} callback Node-style callback called with the error, if any, and Empty - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(IdentityAwareProxyOAuthService.prototype.deleteIdentityAwareProxyClient = function deleteIdentityAwareProxyClient(request, callback) { - return this.rpcCall(deleteIdentityAwareProxyClient, $root.google.cloud.iap.v1.DeleteIdentityAwareProxyClientRequest, $root.google.protobuf.Empty, request, callback); - }, "name", { value: "DeleteIdentityAwareProxyClient" }); - - /** - * Calls DeleteIdentityAwareProxyClient. - * @function deleteIdentityAwareProxyClient - * @memberof google.cloud.iap.v1.IdentityAwareProxyOAuthService - * @instance - * @param {google.cloud.iap.v1.IDeleteIdentityAwareProxyClientRequest} request DeleteIdentityAwareProxyClientRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return IdentityAwareProxyOAuthService; - })(); - - v1.GetIapSettingsRequest = (function() { - - /** - * Properties of a GetIapSettingsRequest. + * Properties of an UpdateIapSettingsRequest. * @memberof google.cloud.iap.v1 - * @interface IGetIapSettingsRequest - * @property {string|null} [name] GetIapSettingsRequest name + * @interface IUpdateIapSettingsRequest + * @property {google.cloud.iap.v1.IIapSettings|null} [iapSettings] UpdateIapSettingsRequest iapSettings + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateIapSettingsRequest updateMask */ /** - * Constructs a new GetIapSettingsRequest. + * Constructs a new UpdateIapSettingsRequest. * @memberof google.cloud.iap.v1 - * @classdesc Represents a GetIapSettingsRequest. - * @implements IGetIapSettingsRequest + * @classdesc Represents an UpdateIapSettingsRequest. + * @implements IUpdateIapSettingsRequest * @constructor - * @param {google.cloud.iap.v1.IGetIapSettingsRequest=} [properties] Properties to set + * @param {google.cloud.iap.v1.IUpdateIapSettingsRequest=} [properties] Properties to set */ - function GetIapSettingsRequest(properties) { + function UpdateIapSettingsRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -2434,75 +2339,89 @@ } /** - * GetIapSettingsRequest name. - * @member {string} name - * @memberof google.cloud.iap.v1.GetIapSettingsRequest + * UpdateIapSettingsRequest iapSettings. + * @member {google.cloud.iap.v1.IIapSettings|null|undefined} iapSettings + * @memberof google.cloud.iap.v1.UpdateIapSettingsRequest * @instance */ - GetIapSettingsRequest.prototype.name = ""; + UpdateIapSettingsRequest.prototype.iapSettings = null; /** - * Creates a new GetIapSettingsRequest instance using the specified properties. + * UpdateIapSettingsRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.iap.v1.UpdateIapSettingsRequest + * @instance + */ + UpdateIapSettingsRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateIapSettingsRequest instance using the specified properties. * @function create - * @memberof google.cloud.iap.v1.GetIapSettingsRequest + * @memberof google.cloud.iap.v1.UpdateIapSettingsRequest * @static - * @param {google.cloud.iap.v1.IGetIapSettingsRequest=} [properties] Properties to set - * @returns {google.cloud.iap.v1.GetIapSettingsRequest} GetIapSettingsRequest instance + * @param {google.cloud.iap.v1.IUpdateIapSettingsRequest=} [properties] Properties to set + * @returns {google.cloud.iap.v1.UpdateIapSettingsRequest} UpdateIapSettingsRequest instance */ - GetIapSettingsRequest.create = function create(properties) { - return new GetIapSettingsRequest(properties); + UpdateIapSettingsRequest.create = function create(properties) { + return new UpdateIapSettingsRequest(properties); }; /** - * Encodes the specified GetIapSettingsRequest message. Does not implicitly {@link google.cloud.iap.v1.GetIapSettingsRequest.verify|verify} messages. + * Encodes the specified UpdateIapSettingsRequest message. Does not implicitly {@link google.cloud.iap.v1.UpdateIapSettingsRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.iap.v1.GetIapSettingsRequest + * @memberof google.cloud.iap.v1.UpdateIapSettingsRequest * @static - * @param {google.cloud.iap.v1.IGetIapSettingsRequest} message GetIapSettingsRequest message or plain object to encode + * @param {google.cloud.iap.v1.IUpdateIapSettingsRequest} message UpdateIapSettingsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIapSettingsRequest.encode = function encode(message, writer) { + UpdateIapSettingsRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.iapSettings != null && Object.hasOwnProperty.call(message, "iapSettings")) + $root.google.cloud.iap.v1.IapSettings.encode(message.iapSettings, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetIapSettingsRequest message, length delimited. Does not implicitly {@link google.cloud.iap.v1.GetIapSettingsRequest.verify|verify} messages. + * Encodes the specified UpdateIapSettingsRequest message, length delimited. Does not implicitly {@link google.cloud.iap.v1.UpdateIapSettingsRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.iap.v1.GetIapSettingsRequest + * @memberof google.cloud.iap.v1.UpdateIapSettingsRequest * @static - * @param {google.cloud.iap.v1.IGetIapSettingsRequest} message GetIapSettingsRequest message or plain object to encode + * @param {google.cloud.iap.v1.IUpdateIapSettingsRequest} message UpdateIapSettingsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetIapSettingsRequest.encodeDelimited = function encodeDelimited(message, writer) { + UpdateIapSettingsRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetIapSettingsRequest message from the specified reader or buffer. + * Decodes an UpdateIapSettingsRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.iap.v1.GetIapSettingsRequest + * @memberof google.cloud.iap.v1.UpdateIapSettingsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.iap.v1.GetIapSettingsRequest} GetIapSettingsRequest + * @returns {google.cloud.iap.v1.UpdateIapSettingsRequest} UpdateIapSettingsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetIapSettingsRequest.decode = function decode(reader, length) { + UpdateIapSettingsRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.iap.v1.GetIapSettingsRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.iap.v1.UpdateIapSettingsRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.name = reader.string(); + message.iapSettings = $root.google.cloud.iap.v1.IapSettings.decode(reader, reader.uint32()); + break; + } + case 2: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); break; } default: @@ -2514,230 +2433,12 @@ }; /** - * Decodes a GetIapSettingsRequest message from the specified reader or buffer, length delimited. + * Decodes an UpdateIapSettingsRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.iap.v1.GetIapSettingsRequest + * @memberof google.cloud.iap.v1.UpdateIapSettingsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.iap.v1.GetIapSettingsRequest} GetIapSettingsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetIapSettingsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GetIapSettingsRequest message. - * @function verify - * @memberof google.cloud.iap.v1.GetIapSettingsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GetIapSettingsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - return null; - }; - - /** - * Creates a GetIapSettingsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.iap.v1.GetIapSettingsRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.iap.v1.GetIapSettingsRequest} GetIapSettingsRequest - */ - GetIapSettingsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.iap.v1.GetIapSettingsRequest) - return object; - var message = new $root.google.cloud.iap.v1.GetIapSettingsRequest(); - if (object.name != null) - message.name = String(object.name); - return message; - }; - - /** - * Creates a plain object from a GetIapSettingsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.iap.v1.GetIapSettingsRequest - * @static - * @param {google.cloud.iap.v1.GetIapSettingsRequest} message GetIapSettingsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetIapSettingsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.name = ""; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - return object; - }; - - /** - * Converts this GetIapSettingsRequest to JSON. - * @function toJSON - * @memberof google.cloud.iap.v1.GetIapSettingsRequest - * @instance - * @returns {Object.} JSON object - */ - GetIapSettingsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for GetIapSettingsRequest - * @function getTypeUrl - * @memberof google.cloud.iap.v1.GetIapSettingsRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - GetIapSettingsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.iap.v1.GetIapSettingsRequest"; - }; - - return GetIapSettingsRequest; - })(); - - v1.UpdateIapSettingsRequest = (function() { - - /** - * Properties of an UpdateIapSettingsRequest. - * @memberof google.cloud.iap.v1 - * @interface IUpdateIapSettingsRequest - * @property {google.cloud.iap.v1.IIapSettings|null} [iapSettings] UpdateIapSettingsRequest iapSettings - * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateIapSettingsRequest updateMask - */ - - /** - * Constructs a new UpdateIapSettingsRequest. - * @memberof google.cloud.iap.v1 - * @classdesc Represents an UpdateIapSettingsRequest. - * @implements IUpdateIapSettingsRequest - * @constructor - * @param {google.cloud.iap.v1.IUpdateIapSettingsRequest=} [properties] Properties to set - */ - function UpdateIapSettingsRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * UpdateIapSettingsRequest iapSettings. - * @member {google.cloud.iap.v1.IIapSettings|null|undefined} iapSettings - * @memberof google.cloud.iap.v1.UpdateIapSettingsRequest - * @instance - */ - UpdateIapSettingsRequest.prototype.iapSettings = null; - - /** - * UpdateIapSettingsRequest updateMask. - * @member {google.protobuf.IFieldMask|null|undefined} updateMask - * @memberof google.cloud.iap.v1.UpdateIapSettingsRequest - * @instance - */ - UpdateIapSettingsRequest.prototype.updateMask = null; - - /** - * Creates a new UpdateIapSettingsRequest instance using the specified properties. - * @function create - * @memberof google.cloud.iap.v1.UpdateIapSettingsRequest - * @static - * @param {google.cloud.iap.v1.IUpdateIapSettingsRequest=} [properties] Properties to set - * @returns {google.cloud.iap.v1.UpdateIapSettingsRequest} UpdateIapSettingsRequest instance - */ - UpdateIapSettingsRequest.create = function create(properties) { - return new UpdateIapSettingsRequest(properties); - }; - - /** - * Encodes the specified UpdateIapSettingsRequest message. Does not implicitly {@link google.cloud.iap.v1.UpdateIapSettingsRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.iap.v1.UpdateIapSettingsRequest - * @static - * @param {google.cloud.iap.v1.IUpdateIapSettingsRequest} message UpdateIapSettingsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UpdateIapSettingsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.iapSettings != null && Object.hasOwnProperty.call(message, "iapSettings")) - $root.google.cloud.iap.v1.IapSettings.encode(message.iapSettings, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) - $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified UpdateIapSettingsRequest message, length delimited. Does not implicitly {@link google.cloud.iap.v1.UpdateIapSettingsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.iap.v1.UpdateIapSettingsRequest - * @static - * @param {google.cloud.iap.v1.IUpdateIapSettingsRequest} message UpdateIapSettingsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UpdateIapSettingsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an UpdateIapSettingsRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.iap.v1.UpdateIapSettingsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.iap.v1.UpdateIapSettingsRequest} UpdateIapSettingsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UpdateIapSettingsRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.iap.v1.UpdateIapSettingsRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.iapSettings = $root.google.cloud.iap.v1.IapSettings.decode(reader, reader.uint32()); - break; - } - case 2: { - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an UpdateIapSettingsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.iap.v1.UpdateIapSettingsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.iap.v1.UpdateIapSettingsRequest} UpdateIapSettingsRequest + * @returns {google.cloud.iap.v1.UpdateIapSettingsRequest} UpdateIapSettingsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ @@ -3119,6 +2820,7 @@ * @property {google.cloud.iap.v1.ICorsSettings|null} [corsSettings] AccessSettings corsSettings * @property {google.cloud.iap.v1.IOAuthSettings|null} [oauthSettings] AccessSettings oauthSettings * @property {google.cloud.iap.v1.IReauthSettings|null} [reauthSettings] AccessSettings reauthSettings + * @property {google.cloud.iap.v1.IAllowedDomainsSettings|null} [allowedDomainsSettings] AccessSettings allowedDomainsSettings */ /** @@ -3168,6 +2870,14 @@ */ AccessSettings.prototype.reauthSettings = null; + /** + * AccessSettings allowedDomainsSettings. + * @member {google.cloud.iap.v1.IAllowedDomainsSettings|null|undefined} allowedDomainsSettings + * @memberof google.cloud.iap.v1.AccessSettings + * @instance + */ + AccessSettings.prototype.allowedDomainsSettings = null; + /** * Creates a new AccessSettings instance using the specified properties. * @function create @@ -3200,6 +2910,8 @@ $root.google.cloud.iap.v1.OAuthSettings.encode(message.oauthSettings, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); if (message.reauthSettings != null && Object.hasOwnProperty.call(message, "reauthSettings")) $root.google.cloud.iap.v1.ReauthSettings.encode(message.reauthSettings, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.allowedDomainsSettings != null && Object.hasOwnProperty.call(message, "allowedDomainsSettings")) + $root.google.cloud.iap.v1.AllowedDomainsSettings.encode(message.allowedDomainsSettings, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); return writer; }; @@ -3250,6 +2962,10 @@ message.reauthSettings = $root.google.cloud.iap.v1.ReauthSettings.decode(reader, reader.uint32()); break; } + case 7: { + message.allowedDomainsSettings = $root.google.cloud.iap.v1.AllowedDomainsSettings.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -3305,6 +3021,11 @@ if (error) return "reauthSettings." + error; } + if (message.allowedDomainsSettings != null && message.hasOwnProperty("allowedDomainsSettings")) { + var error = $root.google.cloud.iap.v1.AllowedDomainsSettings.verify(message.allowedDomainsSettings); + if (error) + return "allowedDomainsSettings." + error; + } return null; }; @@ -3340,6 +3061,11 @@ throw TypeError(".google.cloud.iap.v1.AccessSettings.reauthSettings: object expected"); message.reauthSettings = $root.google.cloud.iap.v1.ReauthSettings.fromObject(object.reauthSettings); } + if (object.allowedDomainsSettings != null) { + if (typeof object.allowedDomainsSettings !== "object") + throw TypeError(".google.cloud.iap.v1.AccessSettings.allowedDomainsSettings: object expected"); + message.allowedDomainsSettings = $root.google.cloud.iap.v1.AllowedDomainsSettings.fromObject(object.allowedDomainsSettings); + } return message; }; @@ -3361,6 +3087,7 @@ object.corsSettings = null; object.oauthSettings = null; object.reauthSettings = null; + object.allowedDomainsSettings = null; } if (message.gcipSettings != null && message.hasOwnProperty("gcipSettings")) object.gcipSettings = $root.google.cloud.iap.v1.GcipSettings.toObject(message.gcipSettings, options); @@ -3370,6 +3097,8 @@ object.oauthSettings = $root.google.cloud.iap.v1.OAuthSettings.toObject(message.oauthSettings, options); if (message.reauthSettings != null && message.hasOwnProperty("reauthSettings")) object.reauthSettings = $root.google.cloud.iap.v1.ReauthSettings.toObject(message.reauthSettings, options); + if (message.allowedDomainsSettings != null && message.hasOwnProperty("allowedDomainsSettings")) + object.allowedDomainsSettings = $root.google.cloud.iap.v1.AllowedDomainsSettings.toObject(message.allowedDomainsSettings, options); return object; }; @@ -4408,26 +4137,26 @@ return ReauthSettings; })(); - v1.ApplicationSettings = (function() { + v1.AllowedDomainsSettings = (function() { /** - * Properties of an ApplicationSettings. + * Properties of an AllowedDomainsSettings. * @memberof google.cloud.iap.v1 - * @interface IApplicationSettings - * @property {google.cloud.iap.v1.ICsmSettings|null} [csmSettings] ApplicationSettings csmSettings - * @property {google.cloud.iap.v1.IAccessDeniedPageSettings|null} [accessDeniedPageSettings] ApplicationSettings accessDeniedPageSettings - * @property {google.protobuf.IStringValue|null} [cookieDomain] ApplicationSettings cookieDomain + * @interface IAllowedDomainsSettings + * @property {boolean|null} [enable] AllowedDomainsSettings enable + * @property {Array.|null} [domains] AllowedDomainsSettings domains */ /** - * Constructs a new ApplicationSettings. + * Constructs a new AllowedDomainsSettings. * @memberof google.cloud.iap.v1 - * @classdesc Represents an ApplicationSettings. - * @implements IApplicationSettings + * @classdesc Represents an AllowedDomainsSettings. + * @implements IAllowedDomainsSettings * @constructor - * @param {google.cloud.iap.v1.IApplicationSettings=} [properties] Properties to set + * @param {google.cloud.iap.v1.IAllowedDomainsSettings=} [properties] Properties to set */ - function ApplicationSettings(properties) { + function AllowedDomainsSettings(properties) { + this.domains = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -4435,38 +4164,308 @@ } /** - * ApplicationSettings csmSettings. - * @member {google.cloud.iap.v1.ICsmSettings|null|undefined} csmSettings - * @memberof google.cloud.iap.v1.ApplicationSettings + * AllowedDomainsSettings enable. + * @member {boolean|null|undefined} enable + * @memberof google.cloud.iap.v1.AllowedDomainsSettings * @instance */ - ApplicationSettings.prototype.csmSettings = null; + AllowedDomainsSettings.prototype.enable = null; /** - * ApplicationSettings accessDeniedPageSettings. - * @member {google.cloud.iap.v1.IAccessDeniedPageSettings|null|undefined} accessDeniedPageSettings - * @memberof google.cloud.iap.v1.ApplicationSettings + * AllowedDomainsSettings domains. + * @member {Array.} domains + * @memberof google.cloud.iap.v1.AllowedDomainsSettings * @instance */ - ApplicationSettings.prototype.accessDeniedPageSettings = null; + AllowedDomainsSettings.prototype.domains = $util.emptyArray; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; /** - * ApplicationSettings cookieDomain. - * @member {google.protobuf.IStringValue|null|undefined} cookieDomain - * @memberof google.cloud.iap.v1.ApplicationSettings + * AllowedDomainsSettings _enable. + * @member {"enable"|undefined} _enable + * @memberof google.cloud.iap.v1.AllowedDomainsSettings * @instance */ - ApplicationSettings.prototype.cookieDomain = null; + Object.defineProperty(AllowedDomainsSettings.prototype, "_enable", { + get: $util.oneOfGetter($oneOfFields = ["enable"]), + set: $util.oneOfSetter($oneOfFields) + }); /** - * Creates a new ApplicationSettings instance using the specified properties. + * Creates a new AllowedDomainsSettings instance using the specified properties. * @function create - * @memberof google.cloud.iap.v1.ApplicationSettings + * @memberof google.cloud.iap.v1.AllowedDomainsSettings * @static - * @param {google.cloud.iap.v1.IApplicationSettings=} [properties] Properties to set - * @returns {google.cloud.iap.v1.ApplicationSettings} ApplicationSettings instance + * @param {google.cloud.iap.v1.IAllowedDomainsSettings=} [properties] Properties to set + * @returns {google.cloud.iap.v1.AllowedDomainsSettings} AllowedDomainsSettings instance */ - ApplicationSettings.create = function create(properties) { + AllowedDomainsSettings.create = function create(properties) { + return new AllowedDomainsSettings(properties); + }; + + /** + * Encodes the specified AllowedDomainsSettings message. Does not implicitly {@link google.cloud.iap.v1.AllowedDomainsSettings.verify|verify} messages. + * @function encode + * @memberof google.cloud.iap.v1.AllowedDomainsSettings + * @static + * @param {google.cloud.iap.v1.IAllowedDomainsSettings} message AllowedDomainsSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AllowedDomainsSettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.enable != null && Object.hasOwnProperty.call(message, "enable")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.enable); + if (message.domains != null && message.domains.length) + for (var i = 0; i < message.domains.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.domains[i]); + return writer; + }; + + /** + * Encodes the specified AllowedDomainsSettings message, length delimited. Does not implicitly {@link google.cloud.iap.v1.AllowedDomainsSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.iap.v1.AllowedDomainsSettings + * @static + * @param {google.cloud.iap.v1.IAllowedDomainsSettings} message AllowedDomainsSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AllowedDomainsSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AllowedDomainsSettings message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.iap.v1.AllowedDomainsSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.iap.v1.AllowedDomainsSettings} AllowedDomainsSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AllowedDomainsSettings.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.iap.v1.AllowedDomainsSettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.enable = reader.bool(); + break; + } + case 2: { + if (!(message.domains && message.domains.length)) + message.domains = []; + message.domains.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AllowedDomainsSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.iap.v1.AllowedDomainsSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.iap.v1.AllowedDomainsSettings} AllowedDomainsSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AllowedDomainsSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AllowedDomainsSettings message. + * @function verify + * @memberof google.cloud.iap.v1.AllowedDomainsSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AllowedDomainsSettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.enable != null && message.hasOwnProperty("enable")) { + properties._enable = 1; + if (typeof message.enable !== "boolean") + return "enable: boolean expected"; + } + if (message.domains != null && message.hasOwnProperty("domains")) { + if (!Array.isArray(message.domains)) + return "domains: array expected"; + for (var i = 0; i < message.domains.length; ++i) + if (!$util.isString(message.domains[i])) + return "domains: string[] expected"; + } + return null; + }; + + /** + * Creates an AllowedDomainsSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.iap.v1.AllowedDomainsSettings + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.iap.v1.AllowedDomainsSettings} AllowedDomainsSettings + */ + AllowedDomainsSettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.iap.v1.AllowedDomainsSettings) + return object; + var message = new $root.google.cloud.iap.v1.AllowedDomainsSettings(); + if (object.enable != null) + message.enable = Boolean(object.enable); + if (object.domains) { + if (!Array.isArray(object.domains)) + throw TypeError(".google.cloud.iap.v1.AllowedDomainsSettings.domains: array expected"); + message.domains = []; + for (var i = 0; i < object.domains.length; ++i) + message.domains[i] = String(object.domains[i]); + } + return message; + }; + + /** + * Creates a plain object from an AllowedDomainsSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.iap.v1.AllowedDomainsSettings + * @static + * @param {google.cloud.iap.v1.AllowedDomainsSettings} message AllowedDomainsSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AllowedDomainsSettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.domains = []; + if (message.enable != null && message.hasOwnProperty("enable")) { + object.enable = message.enable; + if (options.oneofs) + object._enable = "enable"; + } + if (message.domains && message.domains.length) { + object.domains = []; + for (var j = 0; j < message.domains.length; ++j) + object.domains[j] = message.domains[j]; + } + return object; + }; + + /** + * Converts this AllowedDomainsSettings to JSON. + * @function toJSON + * @memberof google.cloud.iap.v1.AllowedDomainsSettings + * @instance + * @returns {Object.} JSON object + */ + AllowedDomainsSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AllowedDomainsSettings + * @function getTypeUrl + * @memberof google.cloud.iap.v1.AllowedDomainsSettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AllowedDomainsSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.iap.v1.AllowedDomainsSettings"; + }; + + return AllowedDomainsSettings; + })(); + + v1.ApplicationSettings = (function() { + + /** + * Properties of an ApplicationSettings. + * @memberof google.cloud.iap.v1 + * @interface IApplicationSettings + * @property {google.cloud.iap.v1.ICsmSettings|null} [csmSettings] ApplicationSettings csmSettings + * @property {google.cloud.iap.v1.IAccessDeniedPageSettings|null} [accessDeniedPageSettings] ApplicationSettings accessDeniedPageSettings + * @property {google.protobuf.IStringValue|null} [cookieDomain] ApplicationSettings cookieDomain + * @property {google.cloud.iap.v1.IAttributePropagationSettings|null} [attributePropagationSettings] ApplicationSettings attributePropagationSettings + */ + + /** + * Constructs a new ApplicationSettings. + * @memberof google.cloud.iap.v1 + * @classdesc Represents an ApplicationSettings. + * @implements IApplicationSettings + * @constructor + * @param {google.cloud.iap.v1.IApplicationSettings=} [properties] Properties to set + */ + function ApplicationSettings(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ApplicationSettings csmSettings. + * @member {google.cloud.iap.v1.ICsmSettings|null|undefined} csmSettings + * @memberof google.cloud.iap.v1.ApplicationSettings + * @instance + */ + ApplicationSettings.prototype.csmSettings = null; + + /** + * ApplicationSettings accessDeniedPageSettings. + * @member {google.cloud.iap.v1.IAccessDeniedPageSettings|null|undefined} accessDeniedPageSettings + * @memberof google.cloud.iap.v1.ApplicationSettings + * @instance + */ + ApplicationSettings.prototype.accessDeniedPageSettings = null; + + /** + * ApplicationSettings cookieDomain. + * @member {google.protobuf.IStringValue|null|undefined} cookieDomain + * @memberof google.cloud.iap.v1.ApplicationSettings + * @instance + */ + ApplicationSettings.prototype.cookieDomain = null; + + /** + * ApplicationSettings attributePropagationSettings. + * @member {google.cloud.iap.v1.IAttributePropagationSettings|null|undefined} attributePropagationSettings + * @memberof google.cloud.iap.v1.ApplicationSettings + * @instance + */ + ApplicationSettings.prototype.attributePropagationSettings = null; + + /** + * Creates a new ApplicationSettings instance using the specified properties. + * @function create + * @memberof google.cloud.iap.v1.ApplicationSettings + * @static + * @param {google.cloud.iap.v1.IApplicationSettings=} [properties] Properties to set + * @returns {google.cloud.iap.v1.ApplicationSettings} ApplicationSettings instance + */ + ApplicationSettings.create = function create(properties) { return new ApplicationSettings(properties); }; @@ -4488,6 +4487,8 @@ $root.google.cloud.iap.v1.AccessDeniedPageSettings.encode(message.accessDeniedPageSettings, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.cookieDomain != null && Object.hasOwnProperty.call(message, "cookieDomain")) $root.google.protobuf.StringValue.encode(message.cookieDomain, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.attributePropagationSettings != null && Object.hasOwnProperty.call(message, "attributePropagationSettings")) + $root.google.cloud.iap.v1.AttributePropagationSettings.encode(message.attributePropagationSettings, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); return writer; }; @@ -4534,6 +4535,10 @@ message.cookieDomain = $root.google.protobuf.StringValue.decode(reader, reader.uint32()); break; } + case 4: { + message.attributePropagationSettings = $root.google.cloud.iap.v1.AttributePropagationSettings.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -4584,6 +4589,11 @@ if (error) return "cookieDomain." + error; } + if (message.attributePropagationSettings != null && message.hasOwnProperty("attributePropagationSettings")) { + var error = $root.google.cloud.iap.v1.AttributePropagationSettings.verify(message.attributePropagationSettings); + if (error) + return "attributePropagationSettings." + error; + } return null; }; @@ -4614,6 +4624,11 @@ throw TypeError(".google.cloud.iap.v1.ApplicationSettings.cookieDomain: object expected"); message.cookieDomain = $root.google.protobuf.StringValue.fromObject(object.cookieDomain); } + if (object.attributePropagationSettings != null) { + if (typeof object.attributePropagationSettings !== "object") + throw TypeError(".google.cloud.iap.v1.ApplicationSettings.attributePropagationSettings: object expected"); + message.attributePropagationSettings = $root.google.cloud.iap.v1.AttributePropagationSettings.fromObject(object.attributePropagationSettings); + } return message; }; @@ -4634,6 +4649,7 @@ object.csmSettings = null; object.accessDeniedPageSettings = null; object.cookieDomain = null; + object.attributePropagationSettings = null; } if (message.csmSettings != null && message.hasOwnProperty("csmSettings")) object.csmSettings = $root.google.cloud.iap.v1.CsmSettings.toObject(message.csmSettings, options); @@ -4641,6 +4657,8 @@ object.accessDeniedPageSettings = $root.google.cloud.iap.v1.AccessDeniedPageSettings.toObject(message.accessDeniedPageSettings, options); if (message.cookieDomain != null && message.hasOwnProperty("cookieDomain")) object.cookieDomain = $root.google.protobuf.StringValue.toObject(message.cookieDomain, options); + if (message.attributePropagationSettings != null && message.hasOwnProperty("attributePropagationSettings")) + object.attributePropagationSettings = $root.google.cloud.iap.v1.AttributePropagationSettings.toObject(message.attributePropagationSettings, options); return object; }; @@ -4889,6 +4907,7 @@ * @interface IAccessDeniedPageSettings * @property {google.protobuf.IStringValue|null} [accessDeniedPageUri] AccessDeniedPageSettings accessDeniedPageUri * @property {google.protobuf.IBoolValue|null} [generateTroubleshootingUri] AccessDeniedPageSettings generateTroubleshootingUri + * @property {google.protobuf.IBoolValue|null} [remediationTokenGenerationEnabled] AccessDeniedPageSettings remediationTokenGenerationEnabled */ /** @@ -4922,6 +4941,28 @@ */ AccessDeniedPageSettings.prototype.generateTroubleshootingUri = null; + /** + * AccessDeniedPageSettings remediationTokenGenerationEnabled. + * @member {google.protobuf.IBoolValue|null|undefined} remediationTokenGenerationEnabled + * @memberof google.cloud.iap.v1.AccessDeniedPageSettings + * @instance + */ + AccessDeniedPageSettings.prototype.remediationTokenGenerationEnabled = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * AccessDeniedPageSettings _remediationTokenGenerationEnabled. + * @member {"remediationTokenGenerationEnabled"|undefined} _remediationTokenGenerationEnabled + * @memberof google.cloud.iap.v1.AccessDeniedPageSettings + * @instance + */ + Object.defineProperty(AccessDeniedPageSettings.prototype, "_remediationTokenGenerationEnabled", { + get: $util.oneOfGetter($oneOfFields = ["remediationTokenGenerationEnabled"]), + set: $util.oneOfSetter($oneOfFields) + }); + /** * Creates a new AccessDeniedPageSettings instance using the specified properties. * @function create @@ -4950,6 +4991,8 @@ $root.google.protobuf.StringValue.encode(message.accessDeniedPageUri, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); if (message.generateTroubleshootingUri != null && Object.hasOwnProperty.call(message, "generateTroubleshootingUri")) $root.google.protobuf.BoolValue.encode(message.generateTroubleshootingUri, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.remediationTokenGenerationEnabled != null && Object.hasOwnProperty.call(message, "remediationTokenGenerationEnabled")) + $root.google.protobuf.BoolValue.encode(message.remediationTokenGenerationEnabled, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; @@ -4992,6 +5035,10 @@ message.generateTroubleshootingUri = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); break; } + case 3: { + message.remediationTokenGenerationEnabled = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -5027,6 +5074,7 @@ AccessDeniedPageSettings.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + var properties = {}; if (message.accessDeniedPageUri != null && message.hasOwnProperty("accessDeniedPageUri")) { var error = $root.google.protobuf.StringValue.verify(message.accessDeniedPageUri); if (error) @@ -5037,6 +5085,14 @@ if (error) return "generateTroubleshootingUri." + error; } + if (message.remediationTokenGenerationEnabled != null && message.hasOwnProperty("remediationTokenGenerationEnabled")) { + properties._remediationTokenGenerationEnabled = 1; + { + var error = $root.google.protobuf.BoolValue.verify(message.remediationTokenGenerationEnabled); + if (error) + return "remediationTokenGenerationEnabled." + error; + } + } return null; }; @@ -5062,6 +5118,11 @@ throw TypeError(".google.cloud.iap.v1.AccessDeniedPageSettings.generateTroubleshootingUri: object expected"); message.generateTroubleshootingUri = $root.google.protobuf.BoolValue.fromObject(object.generateTroubleshootingUri); } + if (object.remediationTokenGenerationEnabled != null) { + if (typeof object.remediationTokenGenerationEnabled !== "object") + throw TypeError(".google.cloud.iap.v1.AccessDeniedPageSettings.remediationTokenGenerationEnabled: object expected"); + message.remediationTokenGenerationEnabled = $root.google.protobuf.BoolValue.fromObject(object.remediationTokenGenerationEnabled); + } return message; }; @@ -5086,6 +5147,11 @@ object.accessDeniedPageUri = $root.google.protobuf.StringValue.toObject(message.accessDeniedPageUri, options); if (message.generateTroubleshootingUri != null && message.hasOwnProperty("generateTroubleshootingUri")) object.generateTroubleshootingUri = $root.google.protobuf.BoolValue.toObject(message.generateTroubleshootingUri, options); + if (message.remediationTokenGenerationEnabled != null && message.hasOwnProperty("remediationTokenGenerationEnabled")) { + object.remediationTokenGenerationEnabled = $root.google.protobuf.BoolValue.toObject(message.remediationTokenGenerationEnabled, options); + if (options.oneofs) + object._remediationTokenGenerationEnabled = "remediationTokenGenerationEnabled"; + } return object; }; @@ -5118,6 +5184,659 @@ return AccessDeniedPageSettings; })(); + v1.AttributePropagationSettings = (function() { + + /** + * Properties of an AttributePropagationSettings. + * @memberof google.cloud.iap.v1 + * @interface IAttributePropagationSettings + * @property {string|null} [expression] AttributePropagationSettings expression + * @property {Array.|null} [outputCredentials] AttributePropagationSettings outputCredentials + * @property {boolean|null} [enable] AttributePropagationSettings enable + */ + + /** + * Constructs a new AttributePropagationSettings. + * @memberof google.cloud.iap.v1 + * @classdesc Represents an AttributePropagationSettings. + * @implements IAttributePropagationSettings + * @constructor + * @param {google.cloud.iap.v1.IAttributePropagationSettings=} [properties] Properties to set + */ + function AttributePropagationSettings(properties) { + this.outputCredentials = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AttributePropagationSettings expression. + * @member {string|null|undefined} expression + * @memberof google.cloud.iap.v1.AttributePropagationSettings + * @instance + */ + AttributePropagationSettings.prototype.expression = null; + + /** + * AttributePropagationSettings outputCredentials. + * @member {Array.} outputCredentials + * @memberof google.cloud.iap.v1.AttributePropagationSettings + * @instance + */ + AttributePropagationSettings.prototype.outputCredentials = $util.emptyArray; + + /** + * AttributePropagationSettings enable. + * @member {boolean|null|undefined} enable + * @memberof google.cloud.iap.v1.AttributePropagationSettings + * @instance + */ + AttributePropagationSettings.prototype.enable = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * AttributePropagationSettings _expression. + * @member {"expression"|undefined} _expression + * @memberof google.cloud.iap.v1.AttributePropagationSettings + * @instance + */ + Object.defineProperty(AttributePropagationSettings.prototype, "_expression", { + get: $util.oneOfGetter($oneOfFields = ["expression"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * AttributePropagationSettings _enable. + * @member {"enable"|undefined} _enable + * @memberof google.cloud.iap.v1.AttributePropagationSettings + * @instance + */ + Object.defineProperty(AttributePropagationSettings.prototype, "_enable", { + get: $util.oneOfGetter($oneOfFields = ["enable"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new AttributePropagationSettings instance using the specified properties. + * @function create + * @memberof google.cloud.iap.v1.AttributePropagationSettings + * @static + * @param {google.cloud.iap.v1.IAttributePropagationSettings=} [properties] Properties to set + * @returns {google.cloud.iap.v1.AttributePropagationSettings} AttributePropagationSettings instance + */ + AttributePropagationSettings.create = function create(properties) { + return new AttributePropagationSettings(properties); + }; + + /** + * Encodes the specified AttributePropagationSettings message. Does not implicitly {@link google.cloud.iap.v1.AttributePropagationSettings.verify|verify} messages. + * @function encode + * @memberof google.cloud.iap.v1.AttributePropagationSettings + * @static + * @param {google.cloud.iap.v1.IAttributePropagationSettings} message AttributePropagationSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AttributePropagationSettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.expression != null && Object.hasOwnProperty.call(message, "expression")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.expression); + if (message.outputCredentials != null && message.outputCredentials.length) { + writer.uint32(/* id 2, wireType 2 =*/18).fork(); + for (var i = 0; i < message.outputCredentials.length; ++i) + writer.int32(message.outputCredentials[i]); + writer.ldelim(); + } + if (message.enable != null && Object.hasOwnProperty.call(message, "enable")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.enable); + return writer; + }; + + /** + * Encodes the specified AttributePropagationSettings message, length delimited. Does not implicitly {@link google.cloud.iap.v1.AttributePropagationSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.iap.v1.AttributePropagationSettings + * @static + * @param {google.cloud.iap.v1.IAttributePropagationSettings} message AttributePropagationSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AttributePropagationSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AttributePropagationSettings message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.iap.v1.AttributePropagationSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.iap.v1.AttributePropagationSettings} AttributePropagationSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AttributePropagationSettings.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.iap.v1.AttributePropagationSettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.expression = reader.string(); + break; + } + case 2: { + if (!(message.outputCredentials && message.outputCredentials.length)) + message.outputCredentials = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.outputCredentials.push(reader.int32()); + } else + message.outputCredentials.push(reader.int32()); + break; + } + case 3: { + message.enable = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AttributePropagationSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.iap.v1.AttributePropagationSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.iap.v1.AttributePropagationSettings} AttributePropagationSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AttributePropagationSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AttributePropagationSettings message. + * @function verify + * @memberof google.cloud.iap.v1.AttributePropagationSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AttributePropagationSettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.expression != null && message.hasOwnProperty("expression")) { + properties._expression = 1; + if (!$util.isString(message.expression)) + return "expression: string expected"; + } + if (message.outputCredentials != null && message.hasOwnProperty("outputCredentials")) { + if (!Array.isArray(message.outputCredentials)) + return "outputCredentials: array expected"; + for (var i = 0; i < message.outputCredentials.length; ++i) + switch (message.outputCredentials[i]) { + default: + return "outputCredentials: enum value[] expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + } + if (message.enable != null && message.hasOwnProperty("enable")) { + properties._enable = 1; + if (typeof message.enable !== "boolean") + return "enable: boolean expected"; + } + return null; + }; + + /** + * Creates an AttributePropagationSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.iap.v1.AttributePropagationSettings + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.iap.v1.AttributePropagationSettings} AttributePropagationSettings + */ + AttributePropagationSettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.iap.v1.AttributePropagationSettings) + return object; + var message = new $root.google.cloud.iap.v1.AttributePropagationSettings(); + if (object.expression != null) + message.expression = String(object.expression); + if (object.outputCredentials) { + if (!Array.isArray(object.outputCredentials)) + throw TypeError(".google.cloud.iap.v1.AttributePropagationSettings.outputCredentials: array expected"); + message.outputCredentials = []; + for (var i = 0; i < object.outputCredentials.length; ++i) + switch (object.outputCredentials[i]) { + default: + if (typeof object.outputCredentials[i] === "number") { + message.outputCredentials[i] = object.outputCredentials[i]; + break; + } + case "OUTPUT_CREDENTIALS_UNSPECIFIED": + case 0: + message.outputCredentials[i] = 0; + break; + case "HEADER": + case 1: + message.outputCredentials[i] = 1; + break; + case "JWT": + case 2: + message.outputCredentials[i] = 2; + break; + case "RCTOKEN": + case 3: + message.outputCredentials[i] = 3; + break; + } + } + if (object.enable != null) + message.enable = Boolean(object.enable); + return message; + }; + + /** + * Creates a plain object from an AttributePropagationSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.iap.v1.AttributePropagationSettings + * @static + * @param {google.cloud.iap.v1.AttributePropagationSettings} message AttributePropagationSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AttributePropagationSettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.outputCredentials = []; + if (message.expression != null && message.hasOwnProperty("expression")) { + object.expression = message.expression; + if (options.oneofs) + object._expression = "expression"; + } + if (message.outputCredentials && message.outputCredentials.length) { + object.outputCredentials = []; + for (var j = 0; j < message.outputCredentials.length; ++j) + object.outputCredentials[j] = options.enums === String ? $root.google.cloud.iap.v1.AttributePropagationSettings.OutputCredentials[message.outputCredentials[j]] === undefined ? message.outputCredentials[j] : $root.google.cloud.iap.v1.AttributePropagationSettings.OutputCredentials[message.outputCredentials[j]] : message.outputCredentials[j]; + } + if (message.enable != null && message.hasOwnProperty("enable")) { + object.enable = message.enable; + if (options.oneofs) + object._enable = "enable"; + } + return object; + }; + + /** + * Converts this AttributePropagationSettings to JSON. + * @function toJSON + * @memberof google.cloud.iap.v1.AttributePropagationSettings + * @instance + * @returns {Object.} JSON object + */ + AttributePropagationSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AttributePropagationSettings + * @function getTypeUrl + * @memberof google.cloud.iap.v1.AttributePropagationSettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AttributePropagationSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.iap.v1.AttributePropagationSettings"; + }; + + /** + * OutputCredentials enum. + * @name google.cloud.iap.v1.AttributePropagationSettings.OutputCredentials + * @enum {number} + * @property {number} OUTPUT_CREDENTIALS_UNSPECIFIED=0 OUTPUT_CREDENTIALS_UNSPECIFIED value + * @property {number} HEADER=1 HEADER value + * @property {number} JWT=2 JWT value + * @property {number} RCTOKEN=3 RCTOKEN value + */ + AttributePropagationSettings.OutputCredentials = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "OUTPUT_CREDENTIALS_UNSPECIFIED"] = 0; + values[valuesById[1] = "HEADER"] = 1; + values[valuesById[2] = "JWT"] = 2; + values[valuesById[3] = "RCTOKEN"] = 3; + return values; + })(); + + return AttributePropagationSettings; + })(); + + v1.IdentityAwareProxyOAuthService = (function() { + + /** + * Constructs a new IdentityAwareProxyOAuthService service. + * @memberof google.cloud.iap.v1 + * @classdesc Represents an IdentityAwareProxyOAuthService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function IdentityAwareProxyOAuthService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (IdentityAwareProxyOAuthService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = IdentityAwareProxyOAuthService; + + /** + * Creates new IdentityAwareProxyOAuthService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.iap.v1.IdentityAwareProxyOAuthService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {IdentityAwareProxyOAuthService} RPC service. Useful where requests and/or responses are streamed. + */ + IdentityAwareProxyOAuthService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.iap.v1.IdentityAwareProxyOAuthService|listBrands}. + * @memberof google.cloud.iap.v1.IdentityAwareProxyOAuthService + * @typedef ListBrandsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.iap.v1.ListBrandsResponse} [response] ListBrandsResponse + */ + + /** + * Calls ListBrands. + * @function listBrands + * @memberof google.cloud.iap.v1.IdentityAwareProxyOAuthService + * @instance + * @param {google.cloud.iap.v1.IListBrandsRequest} request ListBrandsRequest message or plain object + * @param {google.cloud.iap.v1.IdentityAwareProxyOAuthService.ListBrandsCallback} callback Node-style callback called with the error, if any, and ListBrandsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(IdentityAwareProxyOAuthService.prototype.listBrands = function listBrands(request, callback) { + return this.rpcCall(listBrands, $root.google.cloud.iap.v1.ListBrandsRequest, $root.google.cloud.iap.v1.ListBrandsResponse, request, callback); + }, "name", { value: "ListBrands" }); + + /** + * Calls ListBrands. + * @function listBrands + * @memberof google.cloud.iap.v1.IdentityAwareProxyOAuthService + * @instance + * @param {google.cloud.iap.v1.IListBrandsRequest} request ListBrandsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.iap.v1.IdentityAwareProxyOAuthService|createBrand}. + * @memberof google.cloud.iap.v1.IdentityAwareProxyOAuthService + * @typedef CreateBrandCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.iap.v1.Brand} [response] Brand + */ + + /** + * Calls CreateBrand. + * @function createBrand + * @memberof google.cloud.iap.v1.IdentityAwareProxyOAuthService + * @instance + * @param {google.cloud.iap.v1.ICreateBrandRequest} request CreateBrandRequest message or plain object + * @param {google.cloud.iap.v1.IdentityAwareProxyOAuthService.CreateBrandCallback} callback Node-style callback called with the error, if any, and Brand + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(IdentityAwareProxyOAuthService.prototype.createBrand = function createBrand(request, callback) { + return this.rpcCall(createBrand, $root.google.cloud.iap.v1.CreateBrandRequest, $root.google.cloud.iap.v1.Brand, request, callback); + }, "name", { value: "CreateBrand" }); + + /** + * Calls CreateBrand. + * @function createBrand + * @memberof google.cloud.iap.v1.IdentityAwareProxyOAuthService + * @instance + * @param {google.cloud.iap.v1.ICreateBrandRequest} request CreateBrandRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.iap.v1.IdentityAwareProxyOAuthService|getBrand}. + * @memberof google.cloud.iap.v1.IdentityAwareProxyOAuthService + * @typedef GetBrandCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.iap.v1.Brand} [response] Brand + */ + + /** + * Calls GetBrand. + * @function getBrand + * @memberof google.cloud.iap.v1.IdentityAwareProxyOAuthService + * @instance + * @param {google.cloud.iap.v1.IGetBrandRequest} request GetBrandRequest message or plain object + * @param {google.cloud.iap.v1.IdentityAwareProxyOAuthService.GetBrandCallback} callback Node-style callback called with the error, if any, and Brand + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(IdentityAwareProxyOAuthService.prototype.getBrand = function getBrand(request, callback) { + return this.rpcCall(getBrand, $root.google.cloud.iap.v1.GetBrandRequest, $root.google.cloud.iap.v1.Brand, request, callback); + }, "name", { value: "GetBrand" }); + + /** + * Calls GetBrand. + * @function getBrand + * @memberof google.cloud.iap.v1.IdentityAwareProxyOAuthService + * @instance + * @param {google.cloud.iap.v1.IGetBrandRequest} request GetBrandRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.iap.v1.IdentityAwareProxyOAuthService|createIdentityAwareProxyClient}. + * @memberof google.cloud.iap.v1.IdentityAwareProxyOAuthService + * @typedef CreateIdentityAwareProxyClientCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.iap.v1.IdentityAwareProxyClient} [response] IdentityAwareProxyClient + */ + + /** + * Calls CreateIdentityAwareProxyClient. + * @function createIdentityAwareProxyClient + * @memberof google.cloud.iap.v1.IdentityAwareProxyOAuthService + * @instance + * @param {google.cloud.iap.v1.ICreateIdentityAwareProxyClientRequest} request CreateIdentityAwareProxyClientRequest message or plain object + * @param {google.cloud.iap.v1.IdentityAwareProxyOAuthService.CreateIdentityAwareProxyClientCallback} callback Node-style callback called with the error, if any, and IdentityAwareProxyClient + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(IdentityAwareProxyOAuthService.prototype.createIdentityAwareProxyClient = function createIdentityAwareProxyClient(request, callback) { + return this.rpcCall(createIdentityAwareProxyClient, $root.google.cloud.iap.v1.CreateIdentityAwareProxyClientRequest, $root.google.cloud.iap.v1.IdentityAwareProxyClient, request, callback); + }, "name", { value: "CreateIdentityAwareProxyClient" }); + + /** + * Calls CreateIdentityAwareProxyClient. + * @function createIdentityAwareProxyClient + * @memberof google.cloud.iap.v1.IdentityAwareProxyOAuthService + * @instance + * @param {google.cloud.iap.v1.ICreateIdentityAwareProxyClientRequest} request CreateIdentityAwareProxyClientRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.iap.v1.IdentityAwareProxyOAuthService|listIdentityAwareProxyClients}. + * @memberof google.cloud.iap.v1.IdentityAwareProxyOAuthService + * @typedef ListIdentityAwareProxyClientsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.iap.v1.ListIdentityAwareProxyClientsResponse} [response] ListIdentityAwareProxyClientsResponse + */ + + /** + * Calls ListIdentityAwareProxyClients. + * @function listIdentityAwareProxyClients + * @memberof google.cloud.iap.v1.IdentityAwareProxyOAuthService + * @instance + * @param {google.cloud.iap.v1.IListIdentityAwareProxyClientsRequest} request ListIdentityAwareProxyClientsRequest message or plain object + * @param {google.cloud.iap.v1.IdentityAwareProxyOAuthService.ListIdentityAwareProxyClientsCallback} callback Node-style callback called with the error, if any, and ListIdentityAwareProxyClientsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(IdentityAwareProxyOAuthService.prototype.listIdentityAwareProxyClients = function listIdentityAwareProxyClients(request, callback) { + return this.rpcCall(listIdentityAwareProxyClients, $root.google.cloud.iap.v1.ListIdentityAwareProxyClientsRequest, $root.google.cloud.iap.v1.ListIdentityAwareProxyClientsResponse, request, callback); + }, "name", { value: "ListIdentityAwareProxyClients" }); + + /** + * Calls ListIdentityAwareProxyClients. + * @function listIdentityAwareProxyClients + * @memberof google.cloud.iap.v1.IdentityAwareProxyOAuthService + * @instance + * @param {google.cloud.iap.v1.IListIdentityAwareProxyClientsRequest} request ListIdentityAwareProxyClientsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.iap.v1.IdentityAwareProxyOAuthService|getIdentityAwareProxyClient}. + * @memberof google.cloud.iap.v1.IdentityAwareProxyOAuthService + * @typedef GetIdentityAwareProxyClientCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.iap.v1.IdentityAwareProxyClient} [response] IdentityAwareProxyClient + */ + + /** + * Calls GetIdentityAwareProxyClient. + * @function getIdentityAwareProxyClient + * @memberof google.cloud.iap.v1.IdentityAwareProxyOAuthService + * @instance + * @param {google.cloud.iap.v1.IGetIdentityAwareProxyClientRequest} request GetIdentityAwareProxyClientRequest message or plain object + * @param {google.cloud.iap.v1.IdentityAwareProxyOAuthService.GetIdentityAwareProxyClientCallback} callback Node-style callback called with the error, if any, and IdentityAwareProxyClient + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(IdentityAwareProxyOAuthService.prototype.getIdentityAwareProxyClient = function getIdentityAwareProxyClient(request, callback) { + return this.rpcCall(getIdentityAwareProxyClient, $root.google.cloud.iap.v1.GetIdentityAwareProxyClientRequest, $root.google.cloud.iap.v1.IdentityAwareProxyClient, request, callback); + }, "name", { value: "GetIdentityAwareProxyClient" }); + + /** + * Calls GetIdentityAwareProxyClient. + * @function getIdentityAwareProxyClient + * @memberof google.cloud.iap.v1.IdentityAwareProxyOAuthService + * @instance + * @param {google.cloud.iap.v1.IGetIdentityAwareProxyClientRequest} request GetIdentityAwareProxyClientRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.iap.v1.IdentityAwareProxyOAuthService|resetIdentityAwareProxyClientSecret}. + * @memberof google.cloud.iap.v1.IdentityAwareProxyOAuthService + * @typedef ResetIdentityAwareProxyClientSecretCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.iap.v1.IdentityAwareProxyClient} [response] IdentityAwareProxyClient + */ + + /** + * Calls ResetIdentityAwareProxyClientSecret. + * @function resetIdentityAwareProxyClientSecret + * @memberof google.cloud.iap.v1.IdentityAwareProxyOAuthService + * @instance + * @param {google.cloud.iap.v1.IResetIdentityAwareProxyClientSecretRequest} request ResetIdentityAwareProxyClientSecretRequest message or plain object + * @param {google.cloud.iap.v1.IdentityAwareProxyOAuthService.ResetIdentityAwareProxyClientSecretCallback} callback Node-style callback called with the error, if any, and IdentityAwareProxyClient + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(IdentityAwareProxyOAuthService.prototype.resetIdentityAwareProxyClientSecret = function resetIdentityAwareProxyClientSecret(request, callback) { + return this.rpcCall(resetIdentityAwareProxyClientSecret, $root.google.cloud.iap.v1.ResetIdentityAwareProxyClientSecretRequest, $root.google.cloud.iap.v1.IdentityAwareProxyClient, request, callback); + }, "name", { value: "ResetIdentityAwareProxyClientSecret" }); + + /** + * Calls ResetIdentityAwareProxyClientSecret. + * @function resetIdentityAwareProxyClientSecret + * @memberof google.cloud.iap.v1.IdentityAwareProxyOAuthService + * @instance + * @param {google.cloud.iap.v1.IResetIdentityAwareProxyClientSecretRequest} request ResetIdentityAwareProxyClientSecretRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.iap.v1.IdentityAwareProxyOAuthService|deleteIdentityAwareProxyClient}. + * @memberof google.cloud.iap.v1.IdentityAwareProxyOAuthService + * @typedef DeleteIdentityAwareProxyClientCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteIdentityAwareProxyClient. + * @function deleteIdentityAwareProxyClient + * @memberof google.cloud.iap.v1.IdentityAwareProxyOAuthService + * @instance + * @param {google.cloud.iap.v1.IDeleteIdentityAwareProxyClientRequest} request DeleteIdentityAwareProxyClientRequest message or plain object + * @param {google.cloud.iap.v1.IdentityAwareProxyOAuthService.DeleteIdentityAwareProxyClientCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(IdentityAwareProxyOAuthService.prototype.deleteIdentityAwareProxyClient = function deleteIdentityAwareProxyClient(request, callback) { + return this.rpcCall(deleteIdentityAwareProxyClient, $root.google.cloud.iap.v1.DeleteIdentityAwareProxyClientRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteIdentityAwareProxyClient" }); + + /** + * Calls DeleteIdentityAwareProxyClient. + * @function deleteIdentityAwareProxyClient + * @memberof google.cloud.iap.v1.IdentityAwareProxyOAuthService + * @instance + * @param {google.cloud.iap.v1.IDeleteIdentityAwareProxyClientRequest} request DeleteIdentityAwareProxyClientRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return IdentityAwareProxyOAuthService; + })(); + v1.ListBrandsRequest = (function() { /** diff --git a/packages/google-cloud-iap/protos/protos.json b/packages/google-cloud-iap/protos/protos.json index ca7d193dfe9..1d0b8c520bd 100644 --- a/packages/google-cloud-iap/protos/protos.json +++ b/packages/google-cloud-iap/protos/protos.json @@ -327,132 +327,6 @@ } } }, - "IdentityAwareProxyOAuthService": { - "options": { - "(google.api.default_host)": "iap.googleapis.com", - "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" - }, - "methods": { - "ListBrands": { - "requestType": "ListBrandsRequest", - "responseType": "ListBrandsResponse", - "options": { - "(google.api.http).get": "/v1/{parent=projects/*}/brands" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1/{parent=projects/*}/brands" - } - } - ] - }, - "CreateBrand": { - "requestType": "CreateBrandRequest", - "responseType": "Brand", - "options": { - "(google.api.http).post": "/v1/{parent=projects/*}/brands", - "(google.api.http).body": "brand" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/{parent=projects/*}/brands", - "body": "brand" - } - } - ] - }, - "GetBrand": { - "requestType": "GetBrandRequest", - "responseType": "Brand", - "options": { - "(google.api.http).get": "/v1/{name=projects/*/brands/*}" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1/{name=projects/*/brands/*}" - } - } - ] - }, - "CreateIdentityAwareProxyClient": { - "requestType": "CreateIdentityAwareProxyClientRequest", - "responseType": "IdentityAwareProxyClient", - "options": { - "(google.api.http).post": "/v1/{parent=projects/*/brands/*}/identityAwareProxyClients", - "(google.api.http).body": "identity_aware_proxy_client" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/{parent=projects/*/brands/*}/identityAwareProxyClients", - "body": "identity_aware_proxy_client" - } - } - ] - }, - "ListIdentityAwareProxyClients": { - "requestType": "ListIdentityAwareProxyClientsRequest", - "responseType": "ListIdentityAwareProxyClientsResponse", - "options": { - "(google.api.http).get": "/v1/{parent=projects/*/brands/*}/identityAwareProxyClients" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1/{parent=projects/*/brands/*}/identityAwareProxyClients" - } - } - ] - }, - "GetIdentityAwareProxyClient": { - "requestType": "GetIdentityAwareProxyClientRequest", - "responseType": "IdentityAwareProxyClient", - "options": { - "(google.api.http).get": "/v1/{name=projects/*/brands/*/identityAwareProxyClients/*}" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1/{name=projects/*/brands/*/identityAwareProxyClients/*}" - } - } - ] - }, - "ResetIdentityAwareProxyClientSecret": { - "requestType": "ResetIdentityAwareProxyClientSecretRequest", - "responseType": "IdentityAwareProxyClient", - "options": { - "(google.api.http).post": "/v1/{name=projects/*/brands/*/identityAwareProxyClients/*}:resetSecret", - "(google.api.http).body": "*" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/{name=projects/*/brands/*/identityAwareProxyClients/*}:resetSecret", - "body": "*" - } - } - ] - }, - "DeleteIdentityAwareProxyClient": { - "requestType": "DeleteIdentityAwareProxyClientRequest", - "responseType": "google.protobuf.Empty", - "options": { - "(google.api.http).delete": "/v1/{name=projects/*/brands/*/identityAwareProxyClients/*}" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "delete": "/v1/{name=projects/*/brands/*/identityAwareProxyClients/*}" - } - } - ] - } - } - }, "GetIapSettingsRequest": { "fields": { "name": { @@ -515,6 +389,10 @@ "reauthSettings": { "type": "ReauthSettings", "id": 6 + }, + "allowedDomainsSettings": { + "type": "AllowedDomainsSettings", + "id": 7 } } }, @@ -564,6 +442,11 @@ }, "nested": { "Method": { + "valuesOptions": { + "PASSWORD": { + "deprecated": true + } + }, "values": { "METHOD_UNSPECIFIED": 0, "LOGIN": 1, @@ -580,6 +463,29 @@ } } }, + "AllowedDomainsSettings": { + "oneofs": { + "_enable": { + "oneof": [ + "enable" + ] + } + }, + "fields": { + "enable": { + "type": "bool", + "id": 1, + "options": { + "proto3_optional": true + } + }, + "domains": { + "rule": "repeated", + "type": "string", + "id": 2 + } + } + }, "ApplicationSettings": { "fields": { "csmSettings": { @@ -593,6 +499,10 @@ "cookieDomain": { "type": "google.protobuf.StringValue", "id": 3 + }, + "attributePropagationSettings": { + "type": "AttributePropagationSettings", + "id": 4 } } }, @@ -605,6 +515,13 @@ } }, "AccessDeniedPageSettings": { + "oneofs": { + "_remediationTokenGenerationEnabled": { + "oneof": [ + "remediationTokenGenerationEnabled" + ] + } + }, "fields": { "accessDeniedPageUri": { "type": "google.protobuf.StringValue", @@ -613,6 +530,184 @@ "generateTroubleshootingUri": { "type": "google.protobuf.BoolValue", "id": 2 + }, + "remediationTokenGenerationEnabled": { + "type": "google.protobuf.BoolValue", + "id": 3, + "options": { + "proto3_optional": true + } + } + } + }, + "AttributePropagationSettings": { + "oneofs": { + "_expression": { + "oneof": [ + "expression" + ] + }, + "_enable": { + "oneof": [ + "enable" + ] + } + }, + "fields": { + "expression": { + "type": "string", + "id": 1, + "options": { + "proto3_optional": true + } + }, + "outputCredentials": { + "rule": "repeated", + "type": "OutputCredentials", + "id": 2 + }, + "enable": { + "type": "bool", + "id": 3, + "options": { + "proto3_optional": true + } + } + }, + "nested": { + "OutputCredentials": { + "values": { + "OUTPUT_CREDENTIALS_UNSPECIFIED": 0, + "HEADER": 1, + "JWT": 2, + "RCTOKEN": 3 + } + } + } + }, + "IdentityAwareProxyOAuthService": { + "options": { + "(google.api.default_host)": "iap.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "ListBrands": { + "requestType": "ListBrandsRequest", + "responseType": "ListBrandsResponse", + "options": { + "(google.api.http).get": "/v1/{parent=projects/*}/brands" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{parent=projects/*}/brands" + } + } + ] + }, + "CreateBrand": { + "requestType": "CreateBrandRequest", + "responseType": "Brand", + "options": { + "(google.api.http).post": "/v1/{parent=projects/*}/brands", + "(google.api.http).body": "brand" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{parent=projects/*}/brands", + "body": "brand" + } + } + ] + }, + "GetBrand": { + "requestType": "GetBrandRequest", + "responseType": "Brand", + "options": { + "(google.api.http).get": "/v1/{name=projects/*/brands/*}" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=projects/*/brands/*}" + } + } + ] + }, + "CreateIdentityAwareProxyClient": { + "requestType": "CreateIdentityAwareProxyClientRequest", + "responseType": "IdentityAwareProxyClient", + "options": { + "(google.api.http).post": "/v1/{parent=projects/*/brands/*}/identityAwareProxyClients", + "(google.api.http).body": "identity_aware_proxy_client" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{parent=projects/*/brands/*}/identityAwareProxyClients", + "body": "identity_aware_proxy_client" + } + } + ] + }, + "ListIdentityAwareProxyClients": { + "requestType": "ListIdentityAwareProxyClientsRequest", + "responseType": "ListIdentityAwareProxyClientsResponse", + "options": { + "(google.api.http).get": "/v1/{parent=projects/*/brands/*}/identityAwareProxyClients" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{parent=projects/*/brands/*}/identityAwareProxyClients" + } + } + ] + }, + "GetIdentityAwareProxyClient": { + "requestType": "GetIdentityAwareProxyClientRequest", + "responseType": "IdentityAwareProxyClient", + "options": { + "(google.api.http).get": "/v1/{name=projects/*/brands/*/identityAwareProxyClients/*}" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=projects/*/brands/*/identityAwareProxyClients/*}" + } + } + ] + }, + "ResetIdentityAwareProxyClientSecret": { + "requestType": "ResetIdentityAwareProxyClientSecretRequest", + "responseType": "IdentityAwareProxyClient", + "options": { + "(google.api.http).post": "/v1/{name=projects/*/brands/*/identityAwareProxyClients/*}:resetSecret", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{name=projects/*/brands/*/identityAwareProxyClients/*}:resetSecret", + "body": "*" + } + } + ] + }, + "DeleteIdentityAwareProxyClient": { + "requestType": "DeleteIdentityAwareProxyClientRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v1/{name=projects/*/brands/*/identityAwareProxyClients/*}" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v1/{name=projects/*/brands/*/identityAwareProxyClients/*}" + } + } + ] } } }, diff --git a/packages/google-cloud-iap/samples/generated/v1/identity_aware_proxy_admin_service.create_tunnel_dest_group.js b/packages/google-cloud-iap/samples/generated/v1/identity_aware_proxy_admin_service.create_tunnel_dest_group.js index 8361feb87ac..65f5a9dbad4 100644 --- a/packages/google-cloud-iap/samples/generated/v1/identity_aware_proxy_admin_service.create_tunnel_dest_group.js +++ b/packages/google-cloud-iap/samples/generated/v1/identity_aware_proxy_admin_service.create_tunnel_dest_group.js @@ -39,10 +39,10 @@ function main(parent, tunnelDestGroup, tunnelDestGroupId) { */ // const tunnelDestGroup = {} /** - * Required. The ID to use for the TunnelDestGroup, which becomes the final component of - * the resource name. + * Required. The ID to use for the TunnelDestGroup, which becomes the final + * component of the resource name. * This value must be 4-63 characters, and valid characters - * are `[a-z][0-9]-`. + * are `[a-z]-`. */ // const tunnelDestGroupId = 'abc123' diff --git a/packages/google-cloud-iap/src/v1/identity_aware_proxy_admin_service_client.ts b/packages/google-cloud-iap/src/v1/identity_aware_proxy_admin_service_client.ts index d59036feabe..6e5ae2c4294 100644 --- a/packages/google-cloud-iap/src/v1/identity_aware_proxy_admin_service_client.ts +++ b/packages/google-cloud-iap/src/v1/identity_aware_proxy_admin_service_client.ts @@ -121,6 +121,9 @@ export class IdentityAwareProxyAdminServiceClient { (typeof window !== 'undefined' && typeof window?.fetch === 'function'); opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + // 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; @@ -811,11 +814,11 @@ export class IdentityAwareProxyAdminServiceClient { * @param {google.cloud.iap.v1.TunnelDestGroup} request.tunnelDestGroup * Required. The TunnelDestGroup to create. * @param {string} request.tunnelDestGroupId - * Required. The ID to use for the TunnelDestGroup, which becomes the final component of - * the resource name. + * Required. The ID to use for the TunnelDestGroup, which becomes the final + * component of the resource name. * * This value must be 4-63 characters, and valid characters - * are `{@link 0-9|a-z}-`. + * are `[a-z]-`. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. diff --git a/packages/google-cloud-iap/src/v1/identity_aware_proxy_o_auth_service_client.ts b/packages/google-cloud-iap/src/v1/identity_aware_proxy_o_auth_service_client.ts index 5f6991a83b8..a48d6292815 100644 --- a/packages/google-cloud-iap/src/v1/identity_aware_proxy_o_auth_service_client.ts +++ b/packages/google-cloud-iap/src/v1/identity_aware_proxy_o_auth_service_client.ts @@ -123,6 +123,9 @@ export class IdentityAwareProxyOAuthServiceClient { (typeof window !== 'undefined' && typeof window?.fetch === 'function'); opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + // 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; diff --git a/packages/google-cloud-iap/src/v1beta1/identity_aware_proxy_admin_v1_beta1_client.ts b/packages/google-cloud-iap/src/v1beta1/identity_aware_proxy_admin_v1_beta1_client.ts index 65cf72adc1d..c80b4710738 100644 --- a/packages/google-cloud-iap/src/v1beta1/identity_aware_proxy_admin_v1_beta1_client.ts +++ b/packages/google-cloud-iap/src/v1beta1/identity_aware_proxy_admin_v1_beta1_client.ts @@ -118,6 +118,9 @@ export class IdentityAwareProxyAdminV1Beta1Client { (typeof window !== 'undefined' && typeof window?.fetch === 'function'); opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + // 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;