From 9ef7f2af8a9892f4ca0b8f1d5f9870076264398e Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Tue, 14 Mar 2023 07:02:31 +0000 Subject: [PATCH 1/2] feat: add an enum ENROLLED_SECOND_FACTORS under IapSettings docs: update doc description for field_mask PiperOrigin-RevId: 516408359 Source-Link: https://github.com/googleapis/googleapis/commit/d2d07fc10d0a903a2ddc182005b61e61a5518092 Source-Link: https://github.com/googleapis/googleapis-gen/commit/e22921a569f195bfc940a99b1bafef7472a76c1e Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWlhcC8uT3dsQm90LnlhbWwiLCJoIjoiZTIyOTIxYTU2OWYxOTViZmM5NDBhOTliMWJhZmVmNzQ3MmE3NmMxZSJ9 --- .../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 | 731 ++++++++ ..._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 | 71 + ..._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 | 1351 +++++++++++++++ ...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, 10968 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..d4f03a0df2e --- /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..7485f938da2 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1/.jsdoc.js @@ -0,0 +1,55 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 2023 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..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1/.mocharc.js @@ -0,0 +1,33 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1/.prettierrc.js @@ -0,0 +1,22 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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..962f462f26e --- /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.7" + }, + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^18.11.18", + "@types/sinon": "^10.0.13", + "c8": "^7.12.0", + "gts": "^3.1.1", + "jsdoc": "^4.0.0", + "jsdoc-fresh": "^2.0.1", + "jsdoc-region-tag": "^2.0.1", + "linkinator": "^4.1.2", + "mocha": "^10.2.0", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^15.0.1", + "ts-loader": "^8.4.0", + "typescript": "^4.8.4", + "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..7d3421a2a71 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1/protos/google/cloud/iap/v1/service.proto @@ -0,0 +1,731 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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 = "cloud.google.com/go/iap/apiv1/iappb;iappb"; +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"; + } +} + +// 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 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, then all of the settings are updated. See + // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask. + // + // Note: All IAP reauth settings must always be set together, using the + // field mask: `iapSettings.accessSettings.reauthSettings`. + 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; + + // User can use any enabled 2nd factor. + ENROLLED_SECOND_FACTORS = 4; + } + + // 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; +} + +// 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..050fa2b1eda --- /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 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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..6515c06634f --- /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 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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..0c60f7ce498 --- /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 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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..1effeaea0e2 --- /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 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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..2d0b252620a --- /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 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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..fbfe6056396 --- /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 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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..a45e2163ed6 --- /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 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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..a93a5816c1c --- /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 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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..90b85195e53 --- /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,71 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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, then all of the settings are updated. See + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask. + * Note: All IAP reauth settings must always be set together, using the + * field mask: `iapSettings.accessSettings.reauthSettings`. + */ + // 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..0d94f3c79f3 --- /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 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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..503f11953be --- /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 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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..1280905096a --- /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 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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..b6a2d1d8252 --- /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 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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..52ef5199634 --- /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 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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..9a63d757bbd --- /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 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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..535b384710c --- /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 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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..9bccc0b5c42 --- /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 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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..0c91e09caf4 --- /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 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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..16e17a9a7e9 --- /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": 63, + "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..7de39acbc53 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1/src/index.ts @@ -0,0 +1,27 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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..c48a34784ec --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_admin_service_client.ts @@ -0,0 +1,1351 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 {@link google.iam.v1.Policy | 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 {@link google.iam.v1.Policy | 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 {@link google.iam.v1.TestIamPermissionsResponse | 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 {@link google.cloud.iap.v1.IapSettings | 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, then all of the settings are updated. See + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask. + * + * Note: All IAP reauth settings must always be set together, using the + * field mask: `iapSettings.accessSettings.reauthSettings`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 {@link google.cloud.iap.v1.IapSettings | 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 {@link google.cloud.iap.v1.TunnelDestGroup | 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 {@link google.cloud.iap.v1.TunnelDestGroup | 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 {@link google.protobuf.Empty | 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 {@link google.cloud.iap.v1.TunnelDestGroup | 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 {@link google.cloud.iap.v1.TunnelDestGroup | 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 {@link google.cloud.iap.v1.TunnelDestGroup | 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 + * {@link google.cloud.iap.v1.TunnelDestGroup | 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..e4e8aa9022f --- /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 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 {@link google.cloud.iap.v1.ListBrandsResponse | 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 {@link google.cloud.iap.v1.Brand | 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 {@link google.cloud.iap.v1.Brand | 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 {@link google.cloud.iap.v1.IdentityAwareProxyClient | 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 {@link google.cloud.iap.v1.IdentityAwareProxyClient | 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 {@link google.cloud.iap.v1.IdentityAwareProxyClient | 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 {@link google.protobuf.Empty | 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 {@link google.cloud.iap.v1.IdentityAwareProxyClient | 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 {@link google.cloud.iap.v1.IdentityAwareProxyClient | 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 + * {@link google.cloud.iap.v1.IdentityAwareProxyClient | 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..a6f26dfaade --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1/src/v1/index.ts @@ -0,0 +1,20 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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..349e5672789 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1/system-test/fixtures/sample/src/index.js @@ -0,0 +1,28 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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..0947cf985e8 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,38 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1/system-test/install.ts @@ -0,0 +1,49 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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..220acccffbd --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1/test/gapic_identity_aware_proxy_admin_service_v1.ts @@ -0,0 +1,1539 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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..12ba87fba54 --- /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 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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..d4f03a0df2e --- /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..7485f938da2 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1beta1/.jsdoc.js @@ -0,0 +1,55 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 2023 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..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1beta1/.mocharc.js @@ -0,0 +1,33 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1beta1/.prettierrc.js @@ -0,0 +1,22 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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..af1f8fcab74 --- /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.7" + }, + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^18.11.18", + "@types/sinon": "^10.0.13", + "c8": "^7.12.0", + "gts": "^3.1.1", + "jsdoc": "^4.0.0", + "jsdoc-fresh": "^2.0.1", + "jsdoc-region-tag": "^2.0.1", + "linkinator": "^4.1.2", + "mocha": "^10.2.0", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^15.0.1", + "ts-loader": "^8.4.0", + "typescript": "^4.8.4", + "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..c1ead1cfd2c --- /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 = "cloud.google.com/go/iap/apiv1beta1/iappb;iappb"; +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..d4f94c0db67 --- /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 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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..9cf2cd9b9ea --- /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 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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..c12037797a5 --- /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 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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..9a15f63425f --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1beta1/src/index.ts @@ -0,0 +1,25 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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..516a5b0452c --- /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 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 {@link google.iam.v1.Policy | 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 {@link google.iam.v1.Policy | 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 {@link google.iam.v1.TestIamPermissionsResponse | 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..86202e8939b --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1beta1/src/v1beta1/index.ts @@ -0,0 +1,19 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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..0d433d30a07 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1beta1/system-test/fixtures/sample/src/index.js @@ -0,0 +1,27 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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..bab01d545df --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1beta1/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,32 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-iap/v1beta1/system-test/install.ts @@ -0,0 +1,49 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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..f4a64ef1a85 --- /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 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 0068444d585b210eb5f6b1da9f3e6699349d69a9 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Tue, 14 Mar 2023 07:07:00 +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 | 731 -------- ..._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 | 71 - ..._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 | 1351 --------------- ...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 | 184 +- packages/google-cloud-iap/protos/protos.d.ts | 387 ++--- packages/google-cloud-iap/protos/protos.js | 1061 ++++++------ packages/google-cloud-iap/protos/protos.json | 255 +-- ...proxy_admin_service.update_iap_settings.js | 6 +- .../snippet_metadata.google.cloud.iap.v1.json | 4 +- ...pet_metadata.google.cloud.iap.v1beta1.json | 2 +- ...entity_aware_proxy_admin_service_client.ts | 7 +- 79 files changed, 963 insertions(+), 11911 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 d4f03a0df2e..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 7485f938da2..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 2023 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 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1/.prettierrc.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 962f462f26e..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.7" - }, - "devDependencies": { - "@types/mocha": "^10.0.1", - "@types/node": "^18.11.18", - "@types/sinon": "^10.0.13", - "c8": "^7.12.0", - "gts": "^3.1.1", - "jsdoc": "^4.0.0", - "jsdoc-fresh": "^2.0.1", - "jsdoc-region-tag": "^2.0.1", - "linkinator": "^4.1.2", - "mocha": "^10.2.0", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^15.0.1", - "ts-loader": "^8.4.0", - "typescript": "^4.8.4", - "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 7d3421a2a71..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1/protos/google/cloud/iap/v1/service.proto +++ /dev/null @@ -1,731 +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 = "cloud.google.com/go/iap/apiv1/iappb;iappb"; -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"; - } -} - -// 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 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, then all of the settings are updated. See - // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask. - // - // Note: All IAP reauth settings must always be set together, using the - // field mask: `iapSettings.accessSettings.reauthSettings`. - 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; - - // User can use any enabled 2nd factor. - ENROLLED_SECOND_FACTORS = 4; - } - - // 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; -} - -// 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 050fa2b1eda..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 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 6515c06634f..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 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 0c60f7ce498..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 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 1effeaea0e2..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 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 2d0b252620a..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 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 fbfe6056396..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 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 a45e2163ed6..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 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 a93a5816c1c..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 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 90b85195e53..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1/samples/generated/v1/identity_aware_proxy_admin_service.update_iap_settings.js +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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, then all of the settings are updated. See - * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask. - * Note: All IAP reauth settings must always be set together, using the - * field mask: `iapSettings.accessSettings.reauthSettings`. - */ - // 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 0d94f3c79f3..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 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 503f11953be..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 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 1280905096a..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 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 b6a2d1d8252..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 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 52ef5199634..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 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 9a63d757bbd..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 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 535b384710c..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 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 9bccc0b5c42..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 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 0c91e09caf4..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 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 16e17a9a7e9..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": 63, - "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 7de39acbc53..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1/src/index.ts +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 c48a34784ec..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1/src/v1/identity_aware_proxy_admin_service_client.ts +++ /dev/null @@ -1,1351 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 {@link google.iam.v1.Policy | 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 {@link google.iam.v1.Policy | 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 {@link google.iam.v1.TestIamPermissionsResponse | 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 {@link google.cloud.iap.v1.IapSettings | 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, then all of the settings are updated. See - * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask. - * - * Note: All IAP reauth settings must always be set together, using the - * field mask: `iapSettings.accessSettings.reauthSettings`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 {@link google.cloud.iap.v1.IapSettings | 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 {@link google.cloud.iap.v1.TunnelDestGroup | 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 {@link google.cloud.iap.v1.TunnelDestGroup | 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 {@link google.protobuf.Empty | 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 {@link google.cloud.iap.v1.TunnelDestGroup | 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 {@link google.cloud.iap.v1.TunnelDestGroup | 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 {@link google.cloud.iap.v1.TunnelDestGroup | 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 - * {@link google.cloud.iap.v1.TunnelDestGroup | 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 e4e8aa9022f..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 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 {@link google.cloud.iap.v1.ListBrandsResponse | 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 {@link google.cloud.iap.v1.Brand | 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 {@link google.cloud.iap.v1.Brand | 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 {@link google.cloud.iap.v1.IdentityAwareProxyClient | 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 {@link google.cloud.iap.v1.IdentityAwareProxyClient | 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 {@link google.cloud.iap.v1.IdentityAwareProxyClient | 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 {@link google.protobuf.Empty | 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 {@link google.cloud.iap.v1.IdentityAwareProxyClient | 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 {@link google.cloud.iap.v1.IdentityAwareProxyClient | 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 - * {@link google.cloud.iap.v1.IdentityAwareProxyClient | 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 a6f26dfaade..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1/src/v1/index.ts +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 349e5672789..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 0947cf985e8..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 220acccffbd..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 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 12ba87fba54..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 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 d4f03a0df2e..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 7485f938da2..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1beta1/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 2023 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 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1beta1/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1beta1/.prettierrc.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 af1f8fcab74..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.7" - }, - "devDependencies": { - "@types/mocha": "^10.0.1", - "@types/node": "^18.11.18", - "@types/sinon": "^10.0.13", - "c8": "^7.12.0", - "gts": "^3.1.1", - "jsdoc": "^4.0.0", - "jsdoc-fresh": "^2.0.1", - "jsdoc-region-tag": "^2.0.1", - "linkinator": "^4.1.2", - "mocha": "^10.2.0", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^15.0.1", - "ts-loader": "^8.4.0", - "typescript": "^4.8.4", - "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 c1ead1cfd2c..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 = "cloud.google.com/go/iap/apiv1beta1/iappb;iappb"; -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 d4f94c0db67..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 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 9cf2cd9b9ea..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 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 c12037797a5..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 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 9a15f63425f..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1beta1/src/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 516a5b0452c..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 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 {@link google.iam.v1.Policy | 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 {@link google.iam.v1.Policy | 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 {@link google.iam.v1.TestIamPermissionsResponse | 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 86202e8939b..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1beta1/src/v1beta1/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 0d433d30a07..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1beta1/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 bab01d545df..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1beta1/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-iap/v1beta1/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 f4a64ef1a85..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 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 b0ba2e3fbf1..7d3421a2a71 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 @@ -148,6 +148,93 @@ service IdentityAwareProxyAdminService { } } +// 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 to ListTunnelDestGroups. message ListTunnelDestGroupsRequest { // Required. Google Cloud Project ID and location. @@ -286,8 +373,11 @@ message UpdateIapSettingsRequest { 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 + // If omitted, then all of the settings are updated. See + // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask. + // + // Note: All IAP reauth settings must always be set together, using the + // field mask: `iapSettings.accessSettings.reauthSettings`. google.protobuf.FieldMask update_mask = 2; } @@ -371,6 +461,9 @@ message ReauthSettings { // User must use their secure key 2nd factor device. SECURE_KEY = 3; + + // User can use any enabled 2nd factor. + ENROLLED_SECOND_FACTORS = 4; } // Type of policy in the case of hierarchial policies. @@ -508,93 +601,6 @@ message AttributePropagationSettings { 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. diff --git a/packages/google-cloud-iap/protos/protos.d.ts b/packages/google-cloud-iap/protos/protos.d.ts index 6cfd81ddec4..d91f9103297 100644 --- a/packages/google-cloud-iap/protos/protos.d.ts +++ b/packages/google-cloud-iap/protos/protos.d.ts @@ -260,6 +260,198 @@ export namespace google { type UpdateTunnelDestGroupCallback = (error: (Error|null), response?: google.cloud.iap.v1.TunnelDestGroup) => void; } + /** 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 ListTunnelDestGroupsRequest. */ interface IListTunnelDestGroupsRequest { @@ -1830,7 +2022,8 @@ export namespace google { METHOD_UNSPECIFIED = 0, LOGIN = 1, PASSWORD = 2, - SECURE_KEY = 3 + SECURE_KEY = 3, + ENROLLED_SECOND_FACTORS = 4 } /** PolicyType enum. */ @@ -2397,198 +2590,6 @@ export namespace google { } } - /** 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 c6e553bfc13..c17c6002193 100644 --- a/packages/google-cloud-iap/protos/protos.js +++ b/packages/google-cloud-iap/protos/protos.js @@ -431,276 +431,325 @@ return IdentityAwareProxyAdminService; })(); - v1.ListTunnelDestGroupsRequest = (function() { + v1.IdentityAwareProxyOAuthService = (function() { /** - * Properties of a ListTunnelDestGroupsRequest. + * Constructs a new IdentityAwareProxyOAuthService service. * @memberof google.cloud.iap.v1 - * @interface IListTunnelDestGroupsRequest - * @property {string|null} [parent] ListTunnelDestGroupsRequest parent - * @property {number|null} [pageSize] ListTunnelDestGroupsRequest pageSize - * @property {string|null} [pageToken] ListTunnelDestGroupsRequest pageToken + * @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; /** - * Constructs a new ListTunnelDestGroupsRequest. - * @memberof google.cloud.iap.v1 - * @classdesc Represents a ListTunnelDestGroupsRequest. - * @implements IListTunnelDestGroupsRequest - * @constructor - * @param {google.cloud.iap.v1.IListTunnelDestGroupsRequest=} [properties] Properties to set + * 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. */ - function ListTunnelDestGroupsRequest(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.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; /** - * ListTunnelDestGroupsRequest parent. - * @member {string} parent - * @memberof google.cloud.iap.v1.ListTunnelDestGroupsRequest - * @instance + * 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 */ - ListTunnelDestGroupsRequest.prototype.parent = ""; /** - * ListTunnelDestGroupsRequest pageSize. - * @member {number} pageSize - * @memberof google.cloud.iap.v1.ListTunnelDestGroupsRequest + * 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 */ - ListTunnelDestGroupsRequest.prototype.pageSize = 0; + 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" }); /** - * ListTunnelDestGroupsRequest pageToken. - * @member {string} pageToken - * @memberof google.cloud.iap.v1.ListTunnelDestGroupsRequest + * 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 */ - ListTunnelDestGroupsRequest.prototype.pageToken = ""; /** - * Creates a new ListTunnelDestGroupsRequest instance using the specified properties. - * @function create - * @memberof google.cloud.iap.v1.ListTunnelDestGroupsRequest - * @static - * @param {google.cloud.iap.v1.IListTunnelDestGroupsRequest=} [properties] Properties to set - * @returns {google.cloud.iap.v1.ListTunnelDestGroupsRequest} ListTunnelDestGroupsRequest instance + * 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 */ - ListTunnelDestGroupsRequest.create = function create(properties) { - return new ListTunnelDestGroupsRequest(properties); - }; /** - * Encodes the specified ListTunnelDestGroupsRequest message. Does not implicitly {@link google.cloud.iap.v1.ListTunnelDestGroupsRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.iap.v1.ListTunnelDestGroupsRequest - * @static - * @param {google.cloud.iap.v1.IListTunnelDestGroupsRequest} message ListTunnelDestGroupsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * 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 */ - ListTunnelDestGroupsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); - if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); - return writer; - }; + 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" }); /** - * Encodes the specified ListTunnelDestGroupsRequest message, length delimited. Does not implicitly {@link google.cloud.iap.v1.ListTunnelDestGroupsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.iap.v1.ListTunnelDestGroupsRequest - * @static - * @param {google.cloud.iap.v1.IListTunnelDestGroupsRequest} message ListTunnelDestGroupsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * 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 */ - ListTunnelDestGroupsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; /** - * Decodes a ListTunnelDestGroupsRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.iap.v1.ListTunnelDestGroupsRequest - * @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.ListTunnelDestGroupsRequest} ListTunnelDestGroupsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * 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 */ - ListTunnelDestGroupsRequest.decode = function 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.ListTunnelDestGroupsRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.parent = reader.string(); - break; - } - case 2: { - message.pageSize = reader.int32(); - break; - } - case 3: { - message.pageToken = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; /** - * Decodes a ListTunnelDestGroupsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.iap.v1.ListTunnelDestGroupsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.iap.v1.ListTunnelDestGroupsRequest} ListTunnelDestGroupsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * 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 */ - ListTunnelDestGroupsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + 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" }); /** - * Verifies a ListTunnelDestGroupsRequest message. - * @function verify - * @memberof google.cloud.iap.v1.ListTunnelDestGroupsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not + * 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 */ - ListTunnelDestGroupsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - if (!$util.isInteger(message.pageSize)) - return "pageSize: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - if (!$util.isString(message.pageToken)) - return "pageToken: string expected"; - return null; - }; /** - * Creates a ListTunnelDestGroupsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.iap.v1.ListTunnelDestGroupsRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.iap.v1.ListTunnelDestGroupsRequest} ListTunnelDestGroupsRequest + * 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 */ - ListTunnelDestGroupsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.iap.v1.ListTunnelDestGroupsRequest) - return object; - var message = new $root.google.cloud.iap.v1.ListTunnelDestGroupsRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.pageSize != null) - message.pageSize = object.pageSize | 0; - if (object.pageToken != null) - message.pageToken = String(object.pageToken); - return message; - }; /** - * Creates a plain object from a ListTunnelDestGroupsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.iap.v1.ListTunnelDestGroupsRequest - * @static - * @param {google.cloud.iap.v1.ListTunnelDestGroupsRequest} message ListTunnelDestGroupsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object + * 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 */ - ListTunnelDestGroupsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.parent = ""; - object.pageSize = 0; - object.pageToken = ""; - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - object.pageSize = message.pageSize; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - object.pageToken = message.pageToken; - return object; - }; + 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" }); /** - * Converts this ListTunnelDestGroupsRequest to JSON. - * @function toJSON - * @memberof google.cloud.iap.v1.ListTunnelDestGroupsRequest + * Calls CreateIdentityAwareProxyClient. + * @function createIdentityAwareProxyClient + * @memberof google.cloud.iap.v1.IdentityAwareProxyOAuthService * @instance - * @returns {Object.} JSON object + * @param {google.cloud.iap.v1.ICreateIdentityAwareProxyClientRequest} request CreateIdentityAwareProxyClientRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ - ListTunnelDestGroupsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; /** - * Gets the default type url for ListTunnelDestGroupsRequest - * @function getTypeUrl - * @memberof google.cloud.iap.v1.ListTunnelDestGroupsRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url + * 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 */ - ListTunnelDestGroupsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.iap.v1.ListTunnelDestGroupsRequest"; - }; - return ListTunnelDestGroupsRequest; + /** + * 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.ListTunnelDestGroupsResponse = (function() { + v1.ListTunnelDestGroupsRequest = (function() { /** - * Properties of a ListTunnelDestGroupsResponse. + * Properties of a ListTunnelDestGroupsRequest. * @memberof google.cloud.iap.v1 - * @interface IListTunnelDestGroupsResponse - * @property {Array.|null} [tunnelDestGroups] ListTunnelDestGroupsResponse tunnelDestGroups - * @property {string|null} [nextPageToken] ListTunnelDestGroupsResponse nextPageToken + * @interface IListTunnelDestGroupsRequest + * @property {string|null} [parent] ListTunnelDestGroupsRequest parent + * @property {number|null} [pageSize] ListTunnelDestGroupsRequest pageSize + * @property {string|null} [pageToken] ListTunnelDestGroupsRequest pageToken */ /** - * Constructs a new ListTunnelDestGroupsResponse. + * Constructs a new ListTunnelDestGroupsRequest. * @memberof google.cloud.iap.v1 - * @classdesc Represents a ListTunnelDestGroupsResponse. - * @implements IListTunnelDestGroupsResponse + * @classdesc Represents a ListTunnelDestGroupsRequest. + * @implements IListTunnelDestGroupsRequest * @constructor - * @param {google.cloud.iap.v1.IListTunnelDestGroupsResponse=} [properties] Properties to set + * @param {google.cloud.iap.v1.IListTunnelDestGroupsRequest=} [properties] Properties to set */ - function ListTunnelDestGroupsResponse(properties) { - this.tunnelDestGroups = []; + function ListTunnelDestGroupsRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -708,46 +757,296 @@ } /** - * ListTunnelDestGroupsResponse tunnelDestGroups. - * @member {Array.} tunnelDestGroups - * @memberof google.cloud.iap.v1.ListTunnelDestGroupsResponse + * ListTunnelDestGroupsRequest parent. + * @member {string} parent + * @memberof google.cloud.iap.v1.ListTunnelDestGroupsRequest * @instance */ - ListTunnelDestGroupsResponse.prototype.tunnelDestGroups = $util.emptyArray; + ListTunnelDestGroupsRequest.prototype.parent = ""; /** - * ListTunnelDestGroupsResponse nextPageToken. - * @member {string} nextPageToken - * @memberof google.cloud.iap.v1.ListTunnelDestGroupsResponse + * ListTunnelDestGroupsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.iap.v1.ListTunnelDestGroupsRequest * @instance */ - ListTunnelDestGroupsResponse.prototype.nextPageToken = ""; + ListTunnelDestGroupsRequest.prototype.pageSize = 0; /** - * Creates a new ListTunnelDestGroupsResponse instance using the specified properties. + * ListTunnelDestGroupsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.iap.v1.ListTunnelDestGroupsRequest + * @instance + */ + ListTunnelDestGroupsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListTunnelDestGroupsRequest instance using the specified properties. * @function create - * @memberof google.cloud.iap.v1.ListTunnelDestGroupsResponse + * @memberof google.cloud.iap.v1.ListTunnelDestGroupsRequest * @static - * @param {google.cloud.iap.v1.IListTunnelDestGroupsResponse=} [properties] Properties to set - * @returns {google.cloud.iap.v1.ListTunnelDestGroupsResponse} ListTunnelDestGroupsResponse instance + * @param {google.cloud.iap.v1.IListTunnelDestGroupsRequest=} [properties] Properties to set + * @returns {google.cloud.iap.v1.ListTunnelDestGroupsRequest} ListTunnelDestGroupsRequest instance */ - ListTunnelDestGroupsResponse.create = function create(properties) { - return new ListTunnelDestGroupsResponse(properties); + ListTunnelDestGroupsRequest.create = function create(properties) { + return new ListTunnelDestGroupsRequest(properties); }; /** - * Encodes the specified ListTunnelDestGroupsResponse message. Does not implicitly {@link google.cloud.iap.v1.ListTunnelDestGroupsResponse.verify|verify} messages. + * Encodes the specified ListTunnelDestGroupsRequest message. Does not implicitly {@link google.cloud.iap.v1.ListTunnelDestGroupsRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.iap.v1.ListTunnelDestGroupsResponse + * @memberof google.cloud.iap.v1.ListTunnelDestGroupsRequest * @static - * @param {google.cloud.iap.v1.IListTunnelDestGroupsResponse} message ListTunnelDestGroupsResponse message or plain object to encode + * @param {google.cloud.iap.v1.IListTunnelDestGroupsRequest} message ListTunnelDestGroupsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListTunnelDestGroupsResponse.encode = function encode(message, writer) { + ListTunnelDestGroupsRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.tunnelDestGroups != null && message.tunnelDestGroups.length) + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + return writer; + }; + + /** + * Encodes the specified ListTunnelDestGroupsRequest message, length delimited. Does not implicitly {@link google.cloud.iap.v1.ListTunnelDestGroupsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.iap.v1.ListTunnelDestGroupsRequest + * @static + * @param {google.cloud.iap.v1.IListTunnelDestGroupsRequest} message ListTunnelDestGroupsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListTunnelDestGroupsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListTunnelDestGroupsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.iap.v1.ListTunnelDestGroupsRequest + * @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.ListTunnelDestGroupsRequest} ListTunnelDestGroupsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListTunnelDestGroupsRequest.decode = function 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.ListTunnelDestGroupsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListTunnelDestGroupsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.iap.v1.ListTunnelDestGroupsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.iap.v1.ListTunnelDestGroupsRequest} ListTunnelDestGroupsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListTunnelDestGroupsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListTunnelDestGroupsRequest message. + * @function verify + * @memberof google.cloud.iap.v1.ListTunnelDestGroupsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListTunnelDestGroupsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + return null; + }; + + /** + * Creates a ListTunnelDestGroupsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.iap.v1.ListTunnelDestGroupsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.iap.v1.ListTunnelDestGroupsRequest} ListTunnelDestGroupsRequest + */ + ListTunnelDestGroupsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.iap.v1.ListTunnelDestGroupsRequest) + return object; + var message = new $root.google.cloud.iap.v1.ListTunnelDestGroupsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + return message; + }; + + /** + * Creates a plain object from a ListTunnelDestGroupsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.iap.v1.ListTunnelDestGroupsRequest + * @static + * @param {google.cloud.iap.v1.ListTunnelDestGroupsRequest} message ListTunnelDestGroupsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListTunnelDestGroupsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + return object; + }; + + /** + * Converts this ListTunnelDestGroupsRequest to JSON. + * @function toJSON + * @memberof google.cloud.iap.v1.ListTunnelDestGroupsRequest + * @instance + * @returns {Object.} JSON object + */ + ListTunnelDestGroupsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListTunnelDestGroupsRequest + * @function getTypeUrl + * @memberof google.cloud.iap.v1.ListTunnelDestGroupsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListTunnelDestGroupsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.iap.v1.ListTunnelDestGroupsRequest"; + }; + + return ListTunnelDestGroupsRequest; + })(); + + v1.ListTunnelDestGroupsResponse = (function() { + + /** + * Properties of a ListTunnelDestGroupsResponse. + * @memberof google.cloud.iap.v1 + * @interface IListTunnelDestGroupsResponse + * @property {Array.|null} [tunnelDestGroups] ListTunnelDestGroupsResponse tunnelDestGroups + * @property {string|null} [nextPageToken] ListTunnelDestGroupsResponse nextPageToken + */ + + /** + * Constructs a new ListTunnelDestGroupsResponse. + * @memberof google.cloud.iap.v1 + * @classdesc Represents a ListTunnelDestGroupsResponse. + * @implements IListTunnelDestGroupsResponse + * @constructor + * @param {google.cloud.iap.v1.IListTunnelDestGroupsResponse=} [properties] Properties to set + */ + function ListTunnelDestGroupsResponse(properties) { + this.tunnelDestGroups = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListTunnelDestGroupsResponse tunnelDestGroups. + * @member {Array.} tunnelDestGroups + * @memberof google.cloud.iap.v1.ListTunnelDestGroupsResponse + * @instance + */ + ListTunnelDestGroupsResponse.prototype.tunnelDestGroups = $util.emptyArray; + + /** + * ListTunnelDestGroupsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.iap.v1.ListTunnelDestGroupsResponse + * @instance + */ + ListTunnelDestGroupsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListTunnelDestGroupsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.iap.v1.ListTunnelDestGroupsResponse + * @static + * @param {google.cloud.iap.v1.IListTunnelDestGroupsResponse=} [properties] Properties to set + * @returns {google.cloud.iap.v1.ListTunnelDestGroupsResponse} ListTunnelDestGroupsResponse instance + */ + ListTunnelDestGroupsResponse.create = function create(properties) { + return new ListTunnelDestGroupsResponse(properties); + }; + + /** + * Encodes the specified ListTunnelDestGroupsResponse message. Does not implicitly {@link google.cloud.iap.v1.ListTunnelDestGroupsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.iap.v1.ListTunnelDestGroupsResponse + * @static + * @param {google.cloud.iap.v1.IListTunnelDestGroupsResponse} message ListTunnelDestGroupsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListTunnelDestGroupsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.tunnelDestGroups != null && message.tunnelDestGroups.length) for (var i = 0; i < message.tunnelDestGroups.length; ++i) $root.google.cloud.iap.v1.TunnelDestGroup.encode(message.tunnelDestGroups[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) @@ -3964,6 +4263,7 @@ case 1: case 2: case 3: + case 4: break; } if (message.maxAge != null && message.hasOwnProperty("maxAge")) { @@ -4018,6 +4318,10 @@ case 3: message.method = 3; break; + case "ENROLLED_SECOND_FACTORS": + case 4: + message.method = 4; + break; } if (object.maxAge != null) { if (typeof object.maxAge !== "object") @@ -4108,6 +4412,7 @@ * @property {number} LOGIN=1 LOGIN value * @property {number} PASSWORD=2 PASSWORD value * @property {number} SECURE_KEY=3 SECURE_KEY value + * @property {number} ENROLLED_SECOND_FACTORS=4 ENROLLED_SECOND_FACTORS value */ ReauthSettings.Method = (function() { var valuesById = {}, values = Object.create(valuesById); @@ -4115,6 +4420,7 @@ values[valuesById[1] = "LOGIN"] = 1; values[valuesById[2] = "PASSWORD"] = 2; values[valuesById[3] = "SECURE_KEY"] = 3; + values[valuesById[4] = "ENROLLED_SECOND_FACTORS"] = 4; return values; })(); @@ -5538,305 +5844,6 @@ 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 23a5269bba8..2a0980accd3 100644 --- a/packages/google-cloud-iap/protos/protos.json +++ b/packages/google-cloud-iap/protos/protos.json @@ -198,6 +198,132 @@ } } }, + "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/*}" + } + } + ] + } + } + }, "ListTunnelDestGroupsRequest": { "fields": { "parent": { @@ -451,7 +577,8 @@ "METHOD_UNSPECIFIED": 0, "LOGIN": 1, "PASSWORD": 2, - "SECURE_KEY": 3 + "SECURE_KEY": 3, + "ENROLLED_SECOND_FACTORS": 4 } }, "PolicyType": { @@ -585,132 +712,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/*}" - } - } - ] - } - } - }, "ListBrandsRequest": { "fields": { "parent": { diff --git a/packages/google-cloud-iap/samples/generated/v1/identity_aware_proxy_admin_service.update_iap_settings.js b/packages/google-cloud-iap/samples/generated/v1/identity_aware_proxy_admin_service.update_iap_settings.js index 6b90296261d..90b85195e53 100644 --- a/packages/google-cloud-iap/samples/generated/v1/identity_aware_proxy_admin_service.update_iap_settings.js +++ b/packages/google-cloud-iap/samples/generated/v1/identity_aware_proxy_admin_service.update_iap_settings.js @@ -36,8 +36,10 @@ function main(iapSettings) { // 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 + * If omitted, then all of the settings are updated. See + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask. + * Note: All IAP reauth settings must always be set together, using the + * field mask: `iapSettings.accessSettings.reauthSettings`. */ // const updateMask = {} diff --git a/packages/google-cloud-iap/samples/generated/v1/snippet_metadata.google.cloud.iap.v1.json b/packages/google-cloud-iap/samples/generated/v1/snippet_metadata.google.cloud.iap.v1.json index 47756ccb6ae..35c1d77429e 100644 --- a/packages/google-cloud-iap/samples/generated/v1/snippet_metadata.google.cloud.iap.v1.json +++ b/packages/google-cloud-iap/samples/generated/v1/snippet_metadata.google.cloud.iap.v1.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-iap", - "version": "2.2.0", + "version": "2.2.1", "language": "TYPESCRIPT", "apis": [ { @@ -198,7 +198,7 @@ "segments": [ { "start": 25, - "end": 61, + "end": 63, "type": "FULL" } ], diff --git a/packages/google-cloud-iap/samples/generated/v1beta1/snippet_metadata.google.cloud.iap.v1beta1.json b/packages/google-cloud-iap/samples/generated/v1beta1/snippet_metadata.google.cloud.iap.v1beta1.json index dca0e256496..bba9ff81dc0 100644 --- a/packages/google-cloud-iap/samples/generated/v1beta1/snippet_metadata.google.cloud.iap.v1beta1.json +++ b/packages/google-cloud-iap/samples/generated/v1beta1/snippet_metadata.google.cloud.iap.v1beta1.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-iap", - "version": "2.2.0", + "version": "2.2.1", "language": "TYPESCRIPT", "apis": [ { 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 d40feac81ad..b1ef5a038f8 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 @@ -722,8 +722,11 @@ export class IdentityAwareProxyAdminServiceClient { * 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 + * If omitted, then all of the settings are updated. See + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask. + * + * Note: All IAP reauth settings must always be set together, using the + * field mask: `iapSettings.accessSettings.reauthSettings`. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array.